This: if (1 == InterlockedIncrement ((long *)&lock_counter)) is not safe. You can only check for equal to 0, less than 0, and greater than 0 with InterlockedIncrement | Decrement. Secondly, IIRC lock_counter should be long, so the (long *) typecasting isn't needed. Rob