On 08/19/2013 04:31 PM, Henry Vermaak wrote:
How do you suppose that a mutex in linux will wake up an event loop?
The mutex gets taken before the loop is started. Now the loop blocks when taking it. It is freed whenever an event is scheduled.
Whether or not a mutex blocks when the same thread tries to take it that already owns it and whether a thread that does not "own" it can free it, is an implementation detail that here of course needs to be taken into account. (I once did a Mutex implementation that did block on re-take, but AFAIK there are different implementations.)
AFAIR the FUTEX system call (that is not a MUTEX itself, but only helps to implement one in user space) allows for doing this. But I don't know what in detail pthread.mutex does in detail.
(Anyway, I'll be doing a research on those details when I in fact should do an "Application" implementation that needs it.)
-Michael _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel