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
AcessNative - Adding network support
[tpg/acess2.git]
/
AcessNative
/
acesskernel_src
/
threads_glue.c
diff --git
a/AcessNative/acesskernel_src/threads_glue.c
b/AcessNative/acesskernel_src/threads_glue.c
index
ba407b8
..
c2efb71
100644
(file)
--- a/
AcessNative/acesskernel_src/threads_glue.c
+++ b/
AcessNative/acesskernel_src/threads_glue.c
@@
-18,8
+18,8
@@
typedef void **tShortSpinlock;
//#include "/usr/include/signal.h"
#include <SDL/SDL.h>
#include <pthread.h>
//#include "/usr/include/signal.h"
#include <SDL/SDL.h>
#include <pthread.h>
-#include <assert.h>
+#define NORETURN __attribute__((noreturn))
#include <logdebug.h> // Kernel land, but uses standards
// === CODE ===
#include <logdebug.h> // Kernel land, but uses standards
// === CODE ===
@@
-65,35
+65,31
@@
int Threads_Glue_SemWait(void *Ptr, int Max)
int Threads_Glue_SemSignal( void *Ptr, int AmmountToAdd )
{
int Threads_Glue_SemSignal( void *Ptr, int AmmountToAdd )
{
- int i;
- for( i = 0; i < AmmountToAdd; i ++ )
+ for( int i = 0; i < AmmountToAdd; i ++ )
SDL_SemPost( Ptr );
return AmmountToAdd;
}
SDL_SemPost( Ptr );
return AmmountToAdd;
}
-// --------------------------------------------------------------------
-// Event handling
-// --------------------------------------------------------------------
-int RWLock_AcquireRead(tRWLock *Lock)
+void Threads_Glue_SemDestroy( void *Ptr )
{
{
- if( !Lock->ReaderWaiting ) {
- Lock->ReaderWaiting = malloc(sizeof(pthread_rwlock_t));
- pthread_rwlock_init( (void*)Lock->ReaderWaiting, 0 );
- }
- pthread_rwlock_rdlock( (void*)Lock->ReaderWaiting );
- return 0;
+ SDL_DestroySemaphore(Ptr);
}
}
-int RWLock_AcquireWrite(tRWLock *Lock)
+
+// ---
+// Short Locks
+// ---
+void Threads_int_ShortLock(void **MutexPtr)
{
{
- if( !
Lock->ReaderWaiting
) {
-
Lock->ReaderWaiting = malloc(sizeof(pthread_rwlock_t)
);
- pthread_
rwlock_init( (void*)Lock->ReaderWaiting, 0
);
+ if( !
*MutexPtr
) {
+
*MutexPtr = malloc( sizeof(pthread_mutex_t)
);
+ pthread_
mutex_init(*MutexPtr, NULL
);
}
}
- pthread_rwlock_wrlock( (void*)Lock->ReaderWaiting );
- return 0;
+ pthread_mutex_lock(*MutexPtr);
}
}
-void RWLock_Release(tRWLock *Lock)
+
+void Threads_int_ShortRel(void **MutexPtr)
{
{
- pthread_
rwlock_unlock( (void*)Lock->ReaderWaiting
);
+ pthread_
mutex_unlock(*MutexPtr
);
}
}
+
UCC
git Repository :: git.ucc.asn.au