[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.programming.threads

Re: solaris and linux - concurrency

angels__tear

7/19/2004 3:59:00 PM

The parent thread ends up in a loop that is consistently checking for
available messages. These messages should be provided by the child
thread - but the child thread never seems to execute.

So in short, I need to have the child thread and the parent thread
executing as close to simultaneously as possible. Lock-step isn't
necessary, but I do need to know that both are running through their
loops at a reasonable rate.

1 Answer

Casper H.S. Dik

7/19/2004 5:52:00 PM

0

angels__tear@hotmail.com writes:

>The parent thread ends up in a loop that is consistently checking for
>available messages. These messages should be provided by the child
>thread - but the child thread never seems to execute.

Does the parent ever go to sleep? Busy waiting is not good and will
prevent progress in other threads.

>So in short, I need to have the child thread and the parent thread
>executing as close to simultaneously as possible. Lock-step isn't
>necessary, but I do need to know that both are running through their
>loops at a reasonable rate.

If the "parent" thread needs to wait for work, it should sleep
on a condition variable.

Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.