Shantonu Sen wrote: What are you actually trying to do? If you want to acquire a lock and then execute code in the critical section which might block, you should use a mutex. On x86, kernel mutexes have an adaptive spin before they block on contention, so in practice critical sections of a few instructions should not cause other contending threads to enter the scheduler. Regards, Adriaan van Os _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.... This email sent to site_archiver@lists.apple.com I am just curious to know all the implementation details. I did some tests (in user code) with various locking/atomic methods and noticed that OSSpinlocks are extremely fast, a zillion times faster than pthread mutexes. I am writing a (user code) OSSpinlock equivalent that uses a 1-byte (or 1-bit) flag rather than a 4-byte spinlock. And want to make it as fast as possible.