On Jan 3, 2004, at 10:08 AM, Elizabeth Mattijsen wrote:

At 12:15 -0500 1/3/04, Uri Guttman wrote:
>>>>> "LT" == Leopold Toetsch <[EMAIL PROTECTED]> writes:
LT> These are platform specific details. We will use whatever the
LT> platform/OS provides. In the source code its a LOCK() UNLOCK() pair.
LT> The LOCK() can be any atomic operation and doesn't need to call the
LT> kernel, if the lock is aquired.
if it doesn't call the kernel, how can a thread be blocked?

Think out of the box!


Threads can be blocked in many ways. My forks.pm module uses sockets to block threads ;-).

IO operations which block like that end up calling into the kernel.


But I believe it is usually possible to acquire an uncontested lock without calling into the kernel. When you do need to block (when trying to acquire a lock which is already held by another thread) you may need to enter the kernel. But I think that Leo's point was that in the common case of a successful lock operation, it may not be necessary.

JEff

Reply via email to