git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Usermode/libc - Minor fix to memmove
[tpg/acess2.git]
/
Tools
/
nativelib
/
threads_int.c
diff --git
a/Tools/nativelib/threads_int.c
b/Tools/nativelib/threads_int.c
index
324b952
..
b2ad9f6
100644
(file)
--- a/
Tools/nativelib/threads_int.c
+++ b/
Tools/nativelib/threads_int.c
@@
-8,6
+8,7
@@
#include <stddef.h>
#include <stdlib.h>
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#include <stdint.h>
+#include <stdio.h> // printf debugging
#include <acess_logging.h>
#include <threads_int.h>
#include <pthread_weak.h>
#include <acess_logging.h>
#include <threads_int.h>
#include <pthread_weak.h>
@@
-90,9
+91,9
@@
tThreadIntSem *Threads_int_SemCreate(void)
void Threads_int_SemSignal(tThreadIntSem *Sem)
{
void Threads_int_SemSignal(tThreadIntSem *Sem)
{
- if( sem_
wai
t )
+ if( sem_
pos
t )
{
{
- sem_
wai
t( (void*)Sem );
+ sem_
pos
t( (void*)Sem );
}
else
{
}
else
{
@@
-102,9
+103,12
@@
void Threads_int_SemSignal(tThreadIntSem *Sem)
void Threads_int_SemWaitAll(tThreadIntSem *Sem)
{
void Threads_int_SemWaitAll(tThreadIntSem *Sem)
{
- if( sem_
pos
t )
+ if( sem_
wai
t )
{
{
- sem_post( (void*)Sem );
+ // TODO: Handle multiples
+ sem_wait( (void*)Sem );
+ while( sem_trywait((void*)Sem) )
+ ;
}
else
{
}
else
{
@@
-151,7
+155,9
@@
void SHORTLOCK(tShortSpinlock *Lock)
*Lock = malloc(sizeof(pthread_mutex_t));
pthread_mutex_init(*Lock, NULL);
}
*Lock = malloc(sizeof(pthread_mutex_t));
pthread_mutex_init(*Lock, NULL);
}
+// printf("%p: SHORTLOCK wait\n", lpThreads_This);
pthread_mutex_lock(*Lock);
pthread_mutex_lock(*Lock);
+// printf("%p: SHORTLOCK held %p\n", lpThreads_This, __builtin_return_address(0));
}
}
}
}
@@
-165,6
+171,7
@@
void SHORTREL(tShortSpinlock *Lock)
else
{
pthread_mutex_unlock(*Lock);
else
{
pthread_mutex_unlock(*Lock);
+// printf("%p: SHORTLOCK rel\n", lpThreads_This);
}
}
}
}
UCC
git Repository :: git.ucc.asn.au