Hi, C.Y.M wrote:
Reinhard Nissl wrote:Hi, C.Y.M wrote:It works for me too! Thank you so much. I have applied this patch to the latest thread.[ch] and streamdev works like a charm again. :)Attached you'll find a suggested fix. It works for me here.
Excellent work.
Well, there are still some issues left: 1.) what happens if StartThread() get's never called? Deadlock at childTidChanged.Wait().In what situation would StartThread() not be called?
When pthread_create() fails.
Hmm. I thought of the case where StartThread() is very fast and locks the Mutex, changes childTid, unlocks it, executes Action(), locks the Mutex, changes childTid again and unlocks the mutex. If then Wait() is reached, there is a deadlock.2.) what happens if StartThread() returns before the Wait() is reached? Deadlock at childTidChanged.Wait().Isnt that what the mutex is for?
So some error checking and an additional variable for indicating whether StartThread() returned already will be necessary and maybe a TimedWait(), too.
Bye. -- Dipl.-Inform. (FH) Reinhard Nissl mailto:rnissl@gmx.de