[M3devel] ThreadWin32/LockMutex/giantLock/alertable?
Jay K
jay.krell at cornell.edu
Thu Dec 3 22:20:32 CET 2009
It'd be good to remove the giantLock from LockMutex/UnlockMutex.
Mutexes can be replaced, like in Java, with just interlocked+semaphore -- no wait list (the semaphore would have an implicit wait list) -- or similarly just a Win32 critical section.
I believe the inefficieny of ThreadWin32 having a "giantLock" need not impact folks only using locks -- it is only needed when acting on condition variables, and /possibly/ alert/alertwait (but probably not).
In looking at it, something that bugs me is "act.alertable := FALSE".
That can be outside the lock?
Or remove entirely?
And/or moved to before "RAISE Alerted"?
Or for that matter, AlertWait should always exit with it false?
And Wait should always assert it true?
And there's some redundancy there.
Basically, it should always be FALSE unless within AlertWait?
I'm pretty sure those later options -- alertable is generally false, and writes only need to occur within AlertWait to make it temporarily true. LockMutex could just assert that it is false.
- Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20091203/9845c1e8/attachment-0001.html>
More information about the M3devel
mailing list