Re: mutex problems on Windows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 7 Jul 2009 11:14:02 +0100
Chris Vine <chris@xxxxxxxxxxxxxxxxxxxxx> wrote:

> Richard's approach can be made to work on unix-like OSes (ie those
> where the underlying threading is pthreads) because it respects mutex
> ownership of a locked mutex and the result of double locking a
> non-recursive mutex is defined in pthreads if you choose
> PTHREAD_MUTEX_NORMAL as the mutex type, as deadlocking is mandatory in
> that case, but not otherwise (this is from the POSIX standard):

[snip]

Sorry, scrub that, it's wrong, because this scheme cannot respect mutex
ownership. There is no way you can get the deadlocking thread to unlock
the mutex it is blocking on - it would need to be a different thread,
which is undefined behaviour.

Semaphores or conditional variables it is then.
 
Chris

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux