Re: mutex problems on Windows
- From: Chris Vine <chris cvine freeserve co uk>
- Cc: richard boaz <ivor boaz gmail com>, Gnome List <gtk-list gnome org>
- Subject: Re: mutex problems on Windows
- Date: Tue, 7 Jul 2009 11:19:32 +0100
On Tue, 7 Jul 2009 11:14:02 +0100
Chris Vine <chris cvine freeserve co uk> 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]