spacing changes.
This commit is contained in:
parent
c02e9189cf
commit
3c76c0760f
@ -304,7 +304,8 @@ MTinterface::Init (int forked)
|
||||
|
||||
/* possible the atfork lists should be inited here as well */
|
||||
|
||||
for (int i =0;i<256;i++)pshared_mutexs[i]=NULL;
|
||||
for (int i = 0; i < 256; i++)
|
||||
pshared_mutexs[i] = NULL;
|
||||
|
||||
#if 0
|
||||
item->function = NULL;
|
||||
@ -357,7 +358,7 @@ pthread::create (void *(*func) (void *), pthread_attr * newattr,
|
||||
if (attr.inheritsched == PTHREAD_EXPLICIT_SCHED)
|
||||
{
|
||||
/* FIXME: set the scheduling settings for the new thread */
|
||||
/* sched_thread_setparam(win32_obj_id, attr.schedparam); */
|
||||
/* sched_thread_setparam (win32_obj_id, attr.schedparam); */
|
||||
}
|
||||
ResumeThread (win32_obj_id);
|
||||
}
|
||||
@ -391,7 +392,7 @@ pthread_cond::pthread_cond (pthread_condattr * attr):verifyable_object (PTHREAD_
|
||||
|
||||
this->win32_obj_id =::CreateEvent (&sec_none_nih, false, /* auto signal reset - which I think is pthreads like ? */
|
||||
false, /* start non signaled */
|
||||
NULL /* no name */ );
|
||||
NULL /* no name */);
|
||||
|
||||
if (!this->win32_obj_id)
|
||||
magic = 0;
|
||||
@ -432,8 +433,8 @@ pthread_cond::TimedWait (DWORD dwMilliseconds)
|
||||
{
|
||||
// FIXME: race condition (potentially drop events
|
||||
// Possible solution (single process only) - place this in a critical section.
|
||||
ReleaseMutex(mutex->win32_obj_id);
|
||||
rv = WaitForSingleObject(win32_obj_id, dwMilliseconds);
|
||||
ReleaseMutex (mutex->win32_obj_id);
|
||||
rv = WaitForSingleObject (win32_obj_id, dwMilliseconds);
|
||||
}
|
||||
else
|
||||
rv = SignalObjectAndWait (mutex->win32_obj_id, win32_obj_id, dwMilliseconds,
|
||||
@ -468,7 +469,7 @@ pthread_key::~pthread_key ()
|
||||
if (pthread_key_destructor * dest = MT_INTERFACE->destructors.Remove (this))
|
||||
delete dest;
|
||||
TlsFree (dwTlsIndex);
|
||||
};
|
||||
}
|
||||
|
||||
int
|
||||
pthread_key::set (const void *value)
|
||||
@ -521,23 +522,23 @@ pthread_mutex::pthread_mutex (unsigned short id):verifyable_object (PTHREAD_MUTE
|
||||
if (MT_INTERFACE->pshared_mutexs[id])
|
||||
return;
|
||||
char stringbuf[29];
|
||||
snprintf(stringbuf, 29, "CYGWINMUTEX0x%0x", id & 0x000f);
|
||||
system_printf("name of mutex to transparently open %s\n",stringbuf);
|
||||
snprintf (stringbuf, 29, "CYGWINMUTEX0x%0x", id & 0x000f);
|
||||
system_printf ("name of mutex to transparently open %s\n",stringbuf);
|
||||
this->win32_obj_id =::CreateMutex (&sec_none_nih, false, stringbuf);
|
||||
if (win32_obj_id==0 || (win32_obj_id && GetLastError() != ERROR_ALREADY_EXISTS))
|
||||
if (win32_obj_id==0 || (win32_obj_id && GetLastError () != ERROR_ALREADY_EXISTS))
|
||||
{
|
||||
// the mutex has been deleted or we couldn't get access.
|
||||
// the error_already_exists test is because we are only opening an
|
||||
// existint mutex here
|
||||
system_printf("couldn't get pshared mutex %x, %d\n",win32_obj_id, GetLastError());
|
||||
CloseHandle(win32_obj_id);
|
||||
magic=0;
|
||||
win32_obj_id=NULL;
|
||||
system_printf ("couldn't get pshared mutex %x, %d\n",win32_obj_id, GetLastError ());
|
||||
CloseHandle (win32_obj_id);
|
||||
magic = 0;
|
||||
win32_obj_id = NULL;
|
||||
return;
|
||||
}
|
||||
pshared = PTHREAD_PROCESS_SHARED;
|
||||
|
||||
MT_INTERFACE->pshared_mutexs[id]=this;
|
||||
MT_INTERFACE->pshared_mutexs[id] = this;
|
||||
}
|
||||
|
||||
pthread_mutex::pthread_mutex (pthread_mutex_t *mutex, pthread_mutexattr * attr):verifyable_object (PTHREAD_MUTEX_MAGIC)
|
||||
@ -549,27 +550,27 @@ pthread_mutex::pthread_mutex (pthread_mutex_t *mutex, pthread_mutexattr * attr):
|
||||
// This does open a D.O.S. - the name is guessable (if you are willing to run
|
||||
// thru all possible address values :]
|
||||
char stringbuf[29];
|
||||
unsigned short id=1;
|
||||
unsigned short id = 1;
|
||||
while (id < 256)
|
||||
{
|
||||
snprintf(stringbuf, 29, "CYGWINMUTEX0x%0x", id & 0x000f);
|
||||
system_printf("name of mutex to create %s\n",stringbuf);
|
||||
snprintf (stringbuf, 29, "CYGWINMUTEX0x%0x", id & 0x000f);
|
||||
system_printf ("name of mutex to create %s\n",stringbuf);
|
||||
this->win32_obj_id =::CreateMutex (&sec_none_nih, false, stringbuf);
|
||||
if (this->win32_obj_id && GetLastError() != ERROR_ALREADY_EXISTS)
|
||||
if (this->win32_obj_id && GetLastError () != ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
MT_INTERFACE->pshared_mutexs[id]=this;
|
||||
MT_INTERFACE->pshared_mutexs[id] = this;
|
||||
pshared_mutex *pmutex=(pshared_mutex *)(mutex);
|
||||
pmutex->id=id;
|
||||
pmutex->flags=SYS_BASE;
|
||||
pshared=PTHREAD_PROCESS_SHARED;
|
||||
pmutex->id = id;
|
||||
pmutex->flags = SYS_BASE;
|
||||
pshared = PTHREAD_PROCESS_SHARED;
|
||||
condwaits = 0;
|
||||
return;
|
||||
}
|
||||
id++;
|
||||
CloseHandle(win32_obj_id);
|
||||
CloseHandle (win32_obj_id);
|
||||
}
|
||||
magic=0;
|
||||
win32_obj_id=NULL;
|
||||
magic = 0;
|
||||
win32_obj_id = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -604,7 +605,7 @@ pthread_mutex::~pthread_mutex ()
|
||||
{
|
||||
if (win32_obj_id)
|
||||
CloseHandle (win32_obj_id);
|
||||
win32_obj_id=NULL;
|
||||
win32_obj_id = NULL;
|
||||
}
|
||||
|
||||
int
|
||||
@ -626,12 +627,12 @@ pthread_mutex::UnLock ()
|
||||
}
|
||||
|
||||
pthread_mutex **
|
||||
__pthread_mutex_getpshared(pthread_mutex_t *mutex)
|
||||
__pthread_mutex_getpshared (pthread_mutex_t *mutex)
|
||||
{
|
||||
if ((((pshared_mutex *)(mutex))->flags & SYS_BASE) != SYS_BASE )
|
||||
return (pthread_mutex **)mutex;
|
||||
if ((((pshared_mutex *)(mutex))->flags & SYS_BASE) != SYS_BASE)
|
||||
return (pthread_mutex **) mutex;
|
||||
pshared_mutex *pmutex=(pshared_mutex *)(mutex);
|
||||
if ((MT_INTERFACE->pshared_mutexs[pmutex->id]) != NULL )
|
||||
if ((MT_INTERFACE->pshared_mutexs[pmutex->id]) != NULL)
|
||||
return &(MT_INTERFACE->pshared_mutexs[pmutex->id]);
|
||||
/* attempt to get the existing mutex */
|
||||
pthread_mutex * newmutex;
|
||||
@ -639,7 +640,7 @@ __pthread_mutex_getpshared(pthread_mutex_t *mutex)
|
||||
if (!verifyable_object_isvalid (newmutex, PTHREAD_MUTEX_MAGIC))
|
||||
{
|
||||
delete (newmutex);
|
||||
MT_INTERFACE->pshared_mutexs[pmutex->id]=NULL;
|
||||
MT_INTERFACE->pshared_mutexs[pmutex->id] = NULL;
|
||||
return &(MT_INTERFACE->pshared_mutexs[0]);
|
||||
}
|
||||
return &(MT_INTERFACE->pshared_mutexs[pmutex->id]);
|
||||
@ -652,7 +653,7 @@ pshared (PTHREAD_PROCESS_PRIVATE), mutextype (PTHREAD_MUTEX_DEFAULT)
|
||||
|
||||
pthread_mutexattr::~pthread_mutexattr ()
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
semaphore::semaphore (int pshared, unsigned int value):verifyable_object (SEM_MAGIC)
|
||||
{
|
||||
@ -782,7 +783,7 @@ thread_init_wrapper (void *_arg)
|
||||
|
||||
#if 0
|
||||
// ??? This code only runs if the thread exits by returning.
|
||||
// it's all now in __pthread_exit();
|
||||
// it's all now in __pthread_exit ();
|
||||
#endif
|
||||
/* never reached */
|
||||
return 0;
|
||||
@ -803,7 +804,7 @@ __pthread_create (pthread_t * thread, const pthread_attr_t * attr,
|
||||
*thread = NULL;
|
||||
return EAGAIN;
|
||||
}
|
||||
InterlockedIncrement(&MT_INTERFACE->threadcount);
|
||||
InterlockedIncrement (&MT_INTERFACE->threadcount);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -816,7 +817,7 @@ __pthread_once (pthread_once_t * once_control, void (*init_routine) (void))
|
||||
/* but a cancellation handler is not the right thing. We need this in the thread
|
||||
* cleanup routine. Assumption: a thread can only be in one pthread_once routine
|
||||
* at a time. Stote a mutex_t * in the pthread_structure. if that's non null unlock
|
||||
* on pthread_exit();
|
||||
* on pthread_exit ();
|
||||
*/
|
||||
if (once_control->state == 0)
|
||||
{
|
||||
@ -846,7 +847,7 @@ __pthread_cancel (pthread_t thread)
|
||||
if (thread->cancelstate == PTHREAD_CANCEL_ENABLE)
|
||||
{
|
||||
#if 0
|
||||
/* once all the functions call testcancel(), we will do this */
|
||||
/* once all the functions call testcancel (), we will do this */
|
||||
if (thread->canceltype == PTHREAD_CANCEL_DEFERRED)
|
||||
{
|
||||
}
|
||||
@ -865,176 +866,176 @@ __pthread_cancel (pthread_t thread)
|
||||
|
||||
return ESRCH;
|
||||
/*
|
||||
we return ESRCH until all the required functions call testcancel();
|
||||
we return ESRCH until all the required functions call testcancel ();
|
||||
this will give applications predictable behaviour.
|
||||
|
||||
the required function list is: * indicates done, X indicates not present in cygwin.
|
||||
aio_suspend()
|
||||
*close()
|
||||
*creat()
|
||||
fcntl()
|
||||
fsync()
|
||||
getmsg()
|
||||
getpmsg()
|
||||
lockf()
|
||||
mq_receive()
|
||||
mq_send()
|
||||
msgrcv()
|
||||
msgsnd()
|
||||
msync()
|
||||
nanosleep()
|
||||
open()
|
||||
pause()
|
||||
poll()
|
||||
pread()
|
||||
pthread_cond_timedwait()
|
||||
pthread_cond_wait()
|
||||
*pthread_join()
|
||||
pthread_testcancel()
|
||||
putmsg()
|
||||
putpmsg()
|
||||
pwrite()
|
||||
read()
|
||||
readv()
|
||||
select()
|
||||
sem_wait()
|
||||
sigpause()
|
||||
sigsuspend()
|
||||
sigtimedwait()
|
||||
sigwait()
|
||||
sigwaitinfo()
|
||||
*sleep()
|
||||
system()
|
||||
tcdrain()
|
||||
*usleep()
|
||||
wait()
|
||||
aio_suspend ()
|
||||
*close ()
|
||||
*creat ()
|
||||
fcntl ()
|
||||
fsync ()
|
||||
getmsg ()
|
||||
getpmsg ()
|
||||
lockf ()
|
||||
mq_receive ()
|
||||
mq_send ()
|
||||
msgrcv ()
|
||||
msgsnd ()
|
||||
msync ()
|
||||
nanosleep ()
|
||||
open ()
|
||||
pause ()
|
||||
poll ()
|
||||
pread ()
|
||||
pthread_cond_timedwait ()
|
||||
pthread_cond_wait ()
|
||||
*pthread_join ()
|
||||
pthread_testcancel ()
|
||||
putmsg ()
|
||||
putpmsg ()
|
||||
pwrite ()
|
||||
read ()
|
||||
readv ()
|
||||
select ()
|
||||
sem_wait ()
|
||||
sigpause ()
|
||||
sigsuspend ()
|
||||
sigtimedwait ()
|
||||
sigwait ()
|
||||
sigwaitinfo ()
|
||||
*sleep ()
|
||||
system ()
|
||||
tcdrain ()
|
||||
*usleep ()
|
||||
wait ()
|
||||
wait3()
|
||||
waitid()
|
||||
waitpid()
|
||||
write()
|
||||
writev()
|
||||
waitid ()
|
||||
waitpid ()
|
||||
write ()
|
||||
writev ()
|
||||
|
||||
the optional list is:
|
||||
catclose()
|
||||
catgets()
|
||||
catopen()
|
||||
closedir()
|
||||
closelog()
|
||||
ctermid()
|
||||
dbm_close()
|
||||
dbm_delete()
|
||||
dbm_fetch()
|
||||
dbm_nextkey()
|
||||
dbm_open()
|
||||
dbm_store()
|
||||
dlclose()
|
||||
dlopen()
|
||||
endgrent()
|
||||
endpwent()
|
||||
endutxent()
|
||||
fclose()
|
||||
fcntl()
|
||||
fflush()
|
||||
fgetc()
|
||||
fgetpos()
|
||||
fgets()
|
||||
fgetwc()
|
||||
fgetws()
|
||||
fopen()
|
||||
fprintf()
|
||||
fputc()
|
||||
fputs()
|
||||
fputwc()
|
||||
fputws()
|
||||
fread()
|
||||
freopen()
|
||||
fscanf()
|
||||
fseek()
|
||||
fseeko()
|
||||
fsetpos()
|
||||
ftell()
|
||||
ftello()
|
||||
ftw()
|
||||
fwprintf()
|
||||
fwrite()
|
||||
fwscanf()
|
||||
getc()
|
||||
getc_unlocked()
|
||||
getchar()
|
||||
getchar_unlocked()
|
||||
getcwd()
|
||||
getdate()
|
||||
getgrent()
|
||||
getgrgid()
|
||||
getgrgid_r()
|
||||
getgrnam()
|
||||
getgrnam_r()
|
||||
getlogin()
|
||||
getlogin_r()
|
||||
getpwent()
|
||||
* getpwnam()
|
||||
* getpwnam_r()
|
||||
* getpwuid()
|
||||
* getpwuid_r()
|
||||
gets()
|
||||
getutxent()
|
||||
getutxid()
|
||||
getutxline()
|
||||
getw()
|
||||
getwc()
|
||||
getwchar()
|
||||
getwd()
|
||||
glob()
|
||||
iconv_close()
|
||||
iconv_open()
|
||||
ioctl()
|
||||
lseek()
|
||||
mkstemp()
|
||||
nftw()
|
||||
opendir()
|
||||
openlog()
|
||||
pclose()
|
||||
perror()
|
||||
popen()
|
||||
printf()
|
||||
putc()
|
||||
putc_unlocked()
|
||||
putchar()
|
||||
putchar_unlocked()
|
||||
puts()
|
||||
pututxline()
|
||||
putw()
|
||||
putwc()
|
||||
putwchar()
|
||||
readdir()
|
||||
readdir_r()
|
||||
remove()
|
||||
rename()
|
||||
rewind()
|
||||
rewinddir()
|
||||
scanf()
|
||||
seekdir()
|
||||
semop()
|
||||
setgrent()
|
||||
setpwent()
|
||||
setutxent()
|
||||
strerror()
|
||||
syslog()
|
||||
tmpfile()
|
||||
tmpnam()
|
||||
ttyname()
|
||||
ttyname_r()
|
||||
ungetc()
|
||||
ungetwc()
|
||||
unlink()
|
||||
vfprintf()
|
||||
vfwprintf()
|
||||
vprintf()
|
||||
vwprintf()
|
||||
wprintf()
|
||||
wscanf()
|
||||
catclose ()
|
||||
catgets ()
|
||||
catopen ()
|
||||
closedir ()
|
||||
closelog ()
|
||||
ctermid ()
|
||||
dbm_close ()
|
||||
dbm_delete ()
|
||||
dbm_fetch ()
|
||||
dbm_nextkey ()
|
||||
dbm_open ()
|
||||
dbm_store ()
|
||||
dlclose ()
|
||||
dlopen ()
|
||||
endgrent ()
|
||||
endpwent ()
|
||||
endutxent ()
|
||||
fclose ()
|
||||
fcntl ()
|
||||
fflush ()
|
||||
fgetc ()
|
||||
fgetpos ()
|
||||
fgets ()
|
||||
fgetwc ()
|
||||
fgetws ()
|
||||
fopen ()
|
||||
fprintf ()
|
||||
fputc ()
|
||||
fputs ()
|
||||
fputwc ()
|
||||
fputws ()
|
||||
fread ()
|
||||
freopen ()
|
||||
fscanf ()
|
||||
fseek ()
|
||||
fseeko ()
|
||||
fsetpos ()
|
||||
ftell ()
|
||||
ftello ()
|
||||
ftw ()
|
||||
fwprintf ()
|
||||
fwrite ()
|
||||
fwscanf ()
|
||||
getc ()
|
||||
getc_unlocked ()
|
||||
getchar ()
|
||||
getchar_unlocked ()
|
||||
getcwd ()
|
||||
getdate ()
|
||||
getgrent ()
|
||||
getgrgid ()
|
||||
getgrgid_r ()
|
||||
getgrnam ()
|
||||
getgrnam_r ()
|
||||
getlogin ()
|
||||
getlogin_r ()
|
||||
getpwent ()
|
||||
* getpwnam ()
|
||||
* getpwnam_r ()
|
||||
* getpwuid ()
|
||||
* getpwuid_r ()
|
||||
gets ()
|
||||
getutxent ()
|
||||
getutxid ()
|
||||
getutxline ()
|
||||
getw ()
|
||||
getwc ()
|
||||
getwchar ()
|
||||
getwd ()
|
||||
glob ()
|
||||
iconv_close ()
|
||||
iconv_open ()
|
||||
ioctl ()
|
||||
lseek ()
|
||||
mkstemp ()
|
||||
nftw ()
|
||||
opendir ()
|
||||
openlog ()
|
||||
pclose ()
|
||||
perror ()
|
||||
popen ()
|
||||
printf ()
|
||||
putc ()
|
||||
putc_unlocked ()
|
||||
putchar ()
|
||||
putchar_unlocked ()
|
||||
puts ()
|
||||
pututxline ()
|
||||
putw ()
|
||||
putwc ()
|
||||
putwchar ()
|
||||
readdir ()
|
||||
readdir_r ()
|
||||
remove ()
|
||||
rename ()
|
||||
rewind ()
|
||||
rewinddir ()
|
||||
scanf ()
|
||||
seekdir ()
|
||||
semop ()
|
||||
setgrent ()
|
||||
setpwent ()
|
||||
setutxent ()
|
||||
strerror ()
|
||||
syslog ()
|
||||
tmpfile ()
|
||||
tmpnam ()
|
||||
ttyname ()
|
||||
ttyname_r ()
|
||||
ungetc ()
|
||||
ungetwc ()
|
||||
unlink ()
|
||||
vfprintf ()
|
||||
vfwprintf ()
|
||||
vprintf ()
|
||||
vwprintf ()
|
||||
wprintf ()
|
||||
wscanf ()
|
||||
|
||||
Note, that for fcntl(), for any value of the cmd argument.
|
||||
Note, that for fcntl (), for any value of the cmd argument.
|
||||
|
||||
And we must not introduce cancellation points anywhere else that's part of the posix or
|
||||
opengroup specs.
|
||||
@ -1094,35 +1095,35 @@ __pthread_testcancel (void)
|
||||
* If yes, we're safe, if no, we're not.
|
||||
*/
|
||||
void
|
||||
__pthread_atforkprepare(void)
|
||||
__pthread_atforkprepare (void)
|
||||
{
|
||||
callback *cb=MT_INTERFACE->pthread_prepare;
|
||||
callback *cb = MT_INTERFACE->pthread_prepare;
|
||||
while (cb)
|
||||
{
|
||||
cb->cb();
|
||||
cb=cb->next;
|
||||
cb->cb ();
|
||||
cb = cb->next;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
__pthread_atforkparent(void)
|
||||
__pthread_atforkparent (void)
|
||||
{
|
||||
callback *cb=MT_INTERFACE->pthread_parent;
|
||||
callback *cb = MT_INTERFACE->pthread_parent;
|
||||
while (cb)
|
||||
{
|
||||
cb->cb();
|
||||
cb=cb->next;
|
||||
cb->cb ();
|
||||
cb = cb->next;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
__pthread_atforkchild(void)
|
||||
__pthread_atforkchild (void)
|
||||
{
|
||||
callback *cb=MT_INTERFACE->pthread_child;
|
||||
callback *cb = MT_INTERFACE->pthread_child;
|
||||
while (cb)
|
||||
{
|
||||
cb->cb();
|
||||
cb=cb->next;
|
||||
cb->cb ();
|
||||
cb = cb->next;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1135,9 +1136,9 @@ __pthread_atforkchild(void)
|
||||
* parent and child calls are called in FI-FC order.
|
||||
*/
|
||||
int
|
||||
__pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void))
|
||||
__pthread_atfork (void (*prepare)(void), void (*parent)(void), void (*child)(void))
|
||||
{
|
||||
callback * prepcb=NULL, * parentcb=NULL, * childcb=NULL;
|
||||
callback * prepcb = NULL, * parentcb = NULL, * childcb = NULL;
|
||||
if (prepare)
|
||||
{
|
||||
prepcb = new callback;
|
||||
@ -1170,7 +1171,7 @@ __pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void
|
||||
if (prepcb)
|
||||
{
|
||||
prepcb->cb = prepare;
|
||||
prepcb->next=(callback *)InterlockedExchangePointer((LONG *) &MT_INTERFACE->pthread_prepare, (long int) prepcb);
|
||||
prepcb->next=(callback *)InterlockedExchangePointer ((LONG *) &MT_INTERFACE->pthread_prepare, (long int) prepcb);
|
||||
}
|
||||
if (parentcb)
|
||||
{
|
||||
@ -1179,7 +1180,7 @@ __pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void
|
||||
while (*t)
|
||||
t = &(*t)->next;
|
||||
/* t = pointer to last next in the list */
|
||||
parentcb->next=(callback *)InterlockedExchangePointer((LONG *)t, (long int) parentcb);
|
||||
parentcb->next=(callback *)InterlockedExchangePointer ((LONG *) t, (long int) parentcb);
|
||||
}
|
||||
if (childcb)
|
||||
{
|
||||
@ -1188,7 +1189,7 @@ __pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void
|
||||
while (*t)
|
||||
t = &(*t)->next;
|
||||
/* t = pointer to last next in the list */
|
||||
childcb->next=(callback *)InterlockedExchangePointer((LONG *)t, (long int) childcb);
|
||||
childcb->next=(callback *)InterlockedExchangePointer ((LONG *) t, (long int) childcb);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -1356,7 +1357,7 @@ __pthread_exit (void *value_ptr)
|
||||
MT_INTERFACE->destructors.IterateNull ();
|
||||
|
||||
thread->return_ptr = value_ptr;
|
||||
if (InterlockedDecrement(&MT_INTERFACE->threadcount) == 0)
|
||||
if (InterlockedDecrement (&MT_INTERFACE->threadcount) == 0)
|
||||
exit (0);
|
||||
else
|
||||
ExitThread (0);
|
||||
@ -1383,7 +1384,7 @@ __pthread_join (pthread_t * thread, void **return_val)
|
||||
*return_val = (*thread)->return_ptr;
|
||||
} /* End if */
|
||||
|
||||
pthread_testcancel();
|
||||
pthread_testcancel ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1616,12 +1617,12 @@ __pthread_cond_timedwait (pthread_cond_t * cond, pthread_mutex_t * mutex,
|
||||
int rv;
|
||||
if (!abstime)
|
||||
return EINVAL;
|
||||
pthread_mutex **themutex=NULL;
|
||||
pthread_mutex **themutex = NULL;
|
||||
if (*mutex == PTHREAD_MUTEX_INITIALIZER)
|
||||
__pthread_mutex_init (mutex, NULL);
|
||||
if (( ((pshared_mutex *)(mutex))->flags & SYS_BASE == SYS_BASE ))
|
||||
if ((((pshared_mutex *)(mutex))->flags & SYS_BASE == SYS_BASE))
|
||||
// a pshared mutex
|
||||
themutex = __pthread_mutex_getpshared(mutex);
|
||||
themutex = __pthread_mutex_getpshared (mutex);
|
||||
|
||||
if (!verifyable_object_isvalid (*themutex, PTHREAD_MUTEX_MAGIC))
|
||||
return EINVAL;
|
||||
@ -1648,12 +1649,12 @@ int
|
||||
__pthread_cond_wait (pthread_cond_t * cond, pthread_mutex_t * mutex)
|
||||
{
|
||||
int rv;
|
||||
pthread_mutex_t *themutex=mutex;
|
||||
pthread_mutex_t *themutex = mutex;
|
||||
if (*mutex == PTHREAD_MUTEX_INITIALIZER)
|
||||
__pthread_mutex_init (mutex, NULL);
|
||||
if (( ((pshared_mutex *)(mutex))->flags & SYS_BASE == SYS_BASE ))
|
||||
if ((((pshared_mutex *)(mutex))->flags & SYS_BASE == SYS_BASE))
|
||||
// a pshared mutex
|
||||
themutex = __pthread_mutex_getpshared(mutex);
|
||||
themutex = __pthread_mutex_getpshared (mutex);
|
||||
if (!verifyable_object_isvalid (*themutex, PTHREAD_MUTEX_MAGIC))
|
||||
return EINVAL;
|
||||
if (!verifyable_object_isvalid (*cond, PTHREAD_COND_MAGIC))
|
||||
@ -1786,7 +1787,7 @@ int
|
||||
__pthread_mutex_init (pthread_mutex_t * mutex,
|
||||
const pthread_mutexattr_t * attr)
|
||||
{
|
||||
if (( ((pshared_mutex *)(mutex))->flags & SYS_BASE == SYS_BASE ))
|
||||
if ((((pshared_mutex *)(mutex))->flags & SYS_BASE == SYS_BASE))
|
||||
// a pshared mutex
|
||||
return EBUSY;
|
||||
if (attr && !verifyable_object_isvalid (*attr, PTHREAD_MUTEXATTR_MAGIC))
|
||||
@ -1798,7 +1799,7 @@ __pthread_mutex_init (pthread_mutex_t * mutex,
|
||||
if (attr && (*attr)->pshared == PTHREAD_PROCESS_SHARED)
|
||||
{
|
||||
pthread_mutex_t throwaway = new pthread_mutex (mutex, (*attr));
|
||||
mutex = __pthread_mutex_getpshared((pthread_mutex_t *)mutex);
|
||||
mutex = __pthread_mutex_getpshared ((pthread_mutex_t *) mutex);
|
||||
|
||||
if (!verifyable_object_isvalid (*mutex, PTHREAD_MUTEX_MAGIC))
|
||||
{
|
||||
@ -1822,12 +1823,12 @@ int
|
||||
__pthread_mutex_getprioceiling (const pthread_mutex_t * mutex,
|
||||
int *prioceiling)
|
||||
{
|
||||
pthread_mutex_t *themutex=(pthread_mutex_t *)mutex;
|
||||
pthread_mutex_t *themutex=(pthread_mutex_t *) mutex;
|
||||
if (*mutex == PTHREAD_MUTEX_INITIALIZER)
|
||||
__pthread_mutex_init ((pthread_mutex_t *) mutex, NULL);
|
||||
if (( ((pshared_mutex *)(mutex))->flags & SYS_BASE == SYS_BASE ))
|
||||
if ((((pshared_mutex *)(mutex))->flags & SYS_BASE == SYS_BASE))
|
||||
// a pshared mutex
|
||||
themutex = __pthread_mutex_getpshared((pthread_mutex_t *)mutex);
|
||||
themutex = __pthread_mutex_getpshared ((pthread_mutex_t *) mutex);
|
||||
if (!verifyable_object_isvalid (*themutex, PTHREAD_MUTEX_MAGIC))
|
||||
return EINVAL;
|
||||
/* We don't define _POSIX_THREAD_PRIO_PROTECT because we do't currently support
|
||||
@ -1844,12 +1845,12 @@ __pthread_mutex_getprioceiling (const pthread_mutex_t * mutex,
|
||||
int
|
||||
__pthread_mutex_lock (pthread_mutex_t * mutex)
|
||||
{
|
||||
pthread_mutex_t *themutex=mutex;
|
||||
pthread_mutex_t *themutex = mutex;
|
||||
if (*mutex == PTHREAD_MUTEX_INITIALIZER)
|
||||
__pthread_mutex_init (mutex, NULL);
|
||||
if (( ((pshared_mutex *)(mutex))->flags & SYS_BASE) == SYS_BASE )
|
||||
if ((((pshared_mutex *)(mutex))->flags & SYS_BASE) == SYS_BASE)
|
||||
// a pshared mutex
|
||||
themutex = __pthread_mutex_getpshared(mutex);
|
||||
themutex = __pthread_mutex_getpshared (mutex);
|
||||
if (!verifyable_object_isvalid (*themutex, PTHREAD_MUTEX_MAGIC))
|
||||
return EINVAL;
|
||||
(*themutex)->Lock ();
|
||||
@ -1859,12 +1860,12 @@ __pthread_mutex_lock (pthread_mutex_t * mutex)
|
||||
int
|
||||
__pthread_mutex_trylock (pthread_mutex_t * mutex)
|
||||
{
|
||||
pthread_mutex_t *themutex=mutex;
|
||||
pthread_mutex_t *themutex = mutex;
|
||||
if (*mutex == PTHREAD_MUTEX_INITIALIZER)
|
||||
__pthread_mutex_init (mutex, NULL);
|
||||
if (( ((pshared_mutex *)(mutex))->flags & SYS_BASE) == SYS_BASE )
|
||||
if ((((pshared_mutex *)(mutex))->flags & SYS_BASE) == SYS_BASE)
|
||||
// a pshared mutex
|
||||
themutex = __pthread_mutex_getpshared(mutex);
|
||||
themutex = __pthread_mutex_getpshared (mutex);
|
||||
if (!verifyable_object_isvalid (*themutex, PTHREAD_MUTEX_MAGIC))
|
||||
return EINVAL;
|
||||
if ((*themutex)->TryLock () == WAIT_TIMEOUT)
|
||||
@ -1877,9 +1878,9 @@ __pthread_mutex_unlock (pthread_mutex_t * mutex)
|
||||
{
|
||||
if (*mutex == PTHREAD_MUTEX_INITIALIZER)
|
||||
__pthread_mutex_init (mutex, NULL);
|
||||
if (( ((pshared_mutex *)(mutex))->flags & SYS_BASE) == SYS_BASE )
|
||||
if ((((pshared_mutex *)(mutex))->flags & SYS_BASE) == SYS_BASE)
|
||||
// a pshared mutex
|
||||
mutex = __pthread_mutex_getpshared(mutex);
|
||||
mutex = __pthread_mutex_getpshared (mutex);
|
||||
if (!verifyable_object_isvalid (*mutex, PTHREAD_MUTEX_MAGIC))
|
||||
return EINVAL;
|
||||
(*mutex)->UnLock ();
|
||||
@ -1891,9 +1892,9 @@ __pthread_mutex_destroy (pthread_mutex_t * mutex)
|
||||
{
|
||||
if (*mutex == PTHREAD_MUTEX_INITIALIZER)
|
||||
return 0;
|
||||
if (( ((pshared_mutex *)(mutex))->flags & SYS_BASE) == SYS_BASE )
|
||||
if ((((pshared_mutex *)(mutex))->flags & SYS_BASE) == SYS_BASE)
|
||||
// a pshared mutex
|
||||
mutex = __pthread_mutex_getpshared(mutex);
|
||||
mutex = __pthread_mutex_getpshared (mutex);
|
||||
if (!verifyable_object_isvalid (*mutex, PTHREAD_MUTEX_MAGIC))
|
||||
return EINVAL;
|
||||
|
||||
@ -1910,12 +1911,12 @@ int
|
||||
__pthread_mutex_setprioceiling (pthread_mutex_t * mutex, int prioceiling,
|
||||
int *old_ceiling)
|
||||
{
|
||||
pthread_mutex_t *themutex=mutex;
|
||||
pthread_mutex_t *themutex = mutex;
|
||||
if (*mutex == PTHREAD_MUTEX_INITIALIZER)
|
||||
__pthread_mutex_init (mutex, NULL);
|
||||
if (( ((pshared_mutex *)(mutex))->flags & SYS_BASE == SYS_BASE ))
|
||||
if ((((pshared_mutex *)(mutex))->flags & SYS_BASE == SYS_BASE))
|
||||
// a pshared mutex
|
||||
themutex = __pthread_mutex_getpshared(mutex);
|
||||
themutex = __pthread_mutex_getpshared (mutex);
|
||||
if (!verifyable_object_isvalid (*themutex, PTHREAD_MUTEX_MAGIC))
|
||||
return EINVAL;
|
||||
return ENOSYS;
|
||||
|
Loading…
x
Reference in New Issue
Block a user