[Vm-dev] Why isn't signalSemaphoreWithIndex() thread-safe?

Joshua Gargus schwa at fastmail.us
Sun Sep 20 19:43:45 UTC 2009


Hi,

I've always assumed that signalSemaphoreWithIndex() must be thread-safe;
after all, it's the "official" mechanism for notifying the image that an
asynchronous event has occurred.  However, a pang of paranoia prompted
me to actually look at the code, and it seems clearly unsafe.  This is
bad, because I've been using it to signal events from separate native
threads.

What should we do about this?  It seems to me that it should be wrapped
in a critical section, using the appropriate platform-specific
synchronization primitives.

Thanks,
Josh


More information about the Vm-dev mailing list