Code Review: ThreadLib

atfpt review /shelveset:ThreadLib;REDMOND\tomat

A rough implementation of thread.so.

Ignores differences of Ruby Mutex and .NET Monitor for now:

  • Ruby Mutex.lock in not reentrant by the same thread
  • it could be locked/unlocked from non-owning thread (.NET Monitor
    throws an exception in that case)

Also IronRuby runtime itself is not hardened against race conditions
yet.

Tomas

On Thu, 2008-05-15 at 21:03 -0700, Tomas M. wrote:

  • it could be locked/unlocked from non-owning thread (.NET Monitor
    throws an exception in that case)

Don’t worry about supporting that case.

Most of the people who abused Mutex by trying to use it like a semaphore
have been weeded out since I modified fastthread to raise an exception
for unlocks by non-owners.

(I believe the latest 1.8.6 patchlevels also throw an exception, if
you’re using the C Mutex implementation which is based on fastthread.)

-mental