Multithreading problems
DKerns at westell.com
DKerns at westell.com
Thu Aug 3 15:29:24 UTC 2006
> thread1: locks semaphore, enters critical section, exits critical
> section, unlocks semaphore
> thread 2: attempts to lock semaphore
> thread 1: attempts to lock semaphore
> deadlock
you may not really have the situation that I'm interpreting from your
description, but your describing an engineered deadlock!
thread1: locks semaphore := entering critical section
if you really have a second "method" to "enter critical section", you've
(re)designed the dinning philosophers problem where you have a
lock/semaphore on each "fork".
it's perfectly legit to have multiple threads attempt to lock the semaphore
simultaneously. That is, in fact, the entire purpose of the semaphore.
my $.02.
More information about the uClibc
mailing list