[fpc-pascal] notify and notigyall

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Aug 23 21:00:05 CEST 2007


On Thu, 23 Aug 2007 21:32:41 +0300
ik <idokan at gmail.com> wrote:

> On 8/23/07, Marco van de Voort <marcov at stack.nl> wrote:
> > > Is there an equivalent for Java's sleep and notify/notifyAll in
> > > FPC's rtl ?
> >
> > I'm sorry. I don't know Java that well. Maybe it is easier to
> > describe the exact behaviour that you want instead of drawing a
> > parallel
> 
> Lets say I have synchronized threads, because I do not want to arrive
> to a race condition.
> So I want one thread to sleep as long as another thread is running...
> now "sleep" or "wait" I don't remember, sleep to infinitum unless I'm
> notifying the thread.
> Now if I have more then one thread (for example) that is looking for
> something to finish, I should need to tell every such thread to
> continue running, so I'll use notifyAll.

Maybe you can try

http://www.freepascal.org/docs-html/rtl/system/rtleventwaitfor.html

If this works, you can write a small example for the wiki:
http://wiki.lazarus.freepascal.org/Multithreaded_Application_Tutorial


Mattias



More information about the fpc-pascal mailing list