Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Events in linux

Author: Hristo

Date: 13:18:01 04/24/01

Go up one level in this thread


On April 24, 2001 at 13:15:00, Vincent Diepeveen wrote:

>Hello,
>
>I'm looking for code to make events in linux.
>
>In windows i use functions like
>  WaitForMultipleObjects()

There isn't one! If you depend on this functionality
you migth have to redesign (rethink) something.
Look for conditional variables ...
In general you need the services of pthreads library ...
look for ...
pthread_cond_init
pthread_cond_wait
pthread_cond_*, etc  ...
...
pthread_mutex_init
pthread_mutex_lock // no time out
pthread_mutex_*, etc ...

keep in mind that there is no function to wait on multiple
conditional variables for you. Which makes it difficult when
you need to wait on several things to happen before continue.

Also semaphores do not have a time-out and neither do mutexes,
so you have to couple a mutex+conditional_variable to be able to lock
something with a time out. I've spend some time making things
work so I have classes that encapsulate some of these and are
prety simple. I can send them to you if you want ...
my e-mail address is donquixote@pacbell.net
(it changed but I'm not sure who can fix it for me on this message board)

WaitForMultipleObjects is best implemented by the OS (kuddos to MS),
however it is possible to write it using pthreads.


best regards.
hristo

>
>but i can't find the equivalent of this for linux!
>
>Best regards,
>Vincent



This page took 0.01 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.