This is the mail archive of the mailing list for the pthreas-win32 project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: pthread_cond_timedwait

To all,

Speaking of read/write locks, does anyone know if the POSIX read/write lock
routines (e.g. pthread_rwlock_init()) that I submitted will eventually
become part of the Pthreads-Win32 library?  Seems like someone is already
working on another implementation.  The routines that I submitted were
introduced in UNIX98 and are currently a X/Open standard.  These routines
are portable and are currently available on HP-UX 11.0.

Aurelio Medina

	-----Original Message-----
	Sent:	Thursday, September 09, 1999 10:47 AM
	Subject:	pthread_cond_timedwait

		[Ambrus Mikael]  Dear pthreads colleagues, 

		I'm writing a program that uses pthread_cond_timedwait. In
the book
	that I'm using (Pthreads Programming by Nicols, Buttlar & Proulux
Farell )
	it says that this function should suspend the thread until some
other thread
	calls  pthread_cond_signal, pthread_cond_broadcast OR the system
timer is
	greater than or equal to the third argument (abstime). 

		Since clock_gettime is not implemented and I cant find some
	function that tells me the system time, I've tried to implement my
	version of clock_gettime by using the ansi function clock(). This
	returns the number of ticks that has elapsed since the program was

		But it seams that this is not the same absolute time that
	pthread_cond_timedwait requires since the thread won't awaken.

		Is there another way to acquire the relevant system time?

		Another thing that has bothered me is that I recently
downloaded the
	latest snip of phtreads and now my read/write locks won't work.
Since the
	precompiled lib isn't recognised by the linker (neither with gcc
v20.1 nor
	MSVC 6.0) for some reason, I built the libs using the buildlib.bat
	Here's a snip of the code that fails:

		int pthread_rdwr_wunlock_np (
		   pthread_rdwr_t *rdwrp
		   assert( pthread_mutex_lock(&(rdwrp->mutex)) == 0 );
		   if (rdwrp->writers_writing == 0) {
		      assert( pthread_mutex_unlock(&(rdwrp->mutex)) == 0 );
		      rdwrp->writers_writing = 0;
		      assert(pthread_cond_broadcast(&(rdwrp->lock_free)) ==


		   assert( pthread_mutex_unlock(&(rdwrp->mutex)) == 0 );

		pthread_cond_broadcast returns EINVAL. Does anyone recognise

		Michael Ambrus
		Siemens Elema

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]