GNUify slightly.

This commit is contained in:
Christopher Faylor 2002-09-29 23:56:57 +00:00
parent eb208df05a
commit 881ffcb478
1 changed files with 9 additions and 10 deletions

View File

@ -187,7 +187,7 @@ MTinterface::Init (int forked)
} }
concurrency = 0; concurrency = 0;
threadcount = 1; /*1 current thread when Init occurs.*/ threadcount = 1; /* 1 current thread when Init occurs.*/
pthread::initMainThread (&mainthread, myself->hProcess); pthread::initMainThread (&mainthread, myself->hProcess);
pthread_mutex::initMutex (); pthread_mutex::initMutex ();
@ -2110,7 +2110,7 @@ pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
struct timeb currSysTime; struct timeb currSysTime;
long waitlength; long waitlength;
ftime (&currSysTime); ftime (&currSysTime);
waitlength = (abstime->tv_sec - currSysTime.time) *1000; waitlength = (abstime->tv_sec - currSysTime.time) * 1000;
if (waitlength < 0) if (waitlength < 0)
return ETIMEDOUT; return ETIMEDOUT;
return __pthread_cond_dowait (cond, mutex, waitlength); return __pthread_cond_dowait (cond, mutex, waitlength);
@ -2217,14 +2217,13 @@ __pthread_equal (pthread_t *t1, pthread_t *t2)
/*Mutexes */ /*Mutexes */
/*FIXME: there's a potential race with PTHREAD_MUTEX_INITALIZER: /* FIXME: there's a potential race with PTHREAD_MUTEX_INITALIZER:
*the mutex is not actually inited until the first use. the mutex is not actually inited until the first use.
*So two threads trying to lock/trylock may collide. So two threads trying to lock/trylock may collide.
*Solution: we need a global mutex on mutex creation, or possibly simply Solution: we need a global mutex on mutex creation, or possibly simply
*on all constructors that allow INITIALIZER macros. on all constructors that allow INITIALIZER macros.
*the lock should be very small: only around the init routine, not the lock should be very small: only around the init routine, not
*every test, or all mutex access will be synchronised. every test, or all mutex access will be synchronised. */
*/
int int
pthread_mutex::init (pthread_mutex_t *mutex, pthread_mutex::init (pthread_mutex_t *mutex,