long to tbus

ulab-original
jsorg71 17 years ago
parent ea7553f77c
commit 311b688ad7

@ -64,34 +64,34 @@ tc_thread_create(void* (* start_routine)(void*), void* arg)
#endif #endif
/*****************************************************************************/ /*****************************************************************************/
long APP_CC tbus APP_CC
tc_get_threadid(void) tc_get_threadid(void)
{ {
#if defined(_WIN32) #if defined(_WIN32)
return (long)GetCurrentThreadId(); return (tbus)GetCurrentThreadId();
#else #else
return (long)pthread_self(); return (tbus)pthread_self();
#endif #endif
} }
/*****************************************************************************/ /*****************************************************************************/
long APP_CC tbus APP_CC
tc_mutex_create(void) tc_mutex_create(void)
{ {
#if defined(_WIN32) #if defined(_WIN32)
return (long)CreateMutex(0, 0, 0); return (tbus)CreateMutex(0, 0, 0);
#else #else
pthread_mutex_t* lmutex; pthread_mutex_t* lmutex;
lmutex = (pthread_mutex_t*)g_malloc(sizeof(pthread_mutex_t), 0); lmutex = (pthread_mutex_t*)g_malloc(sizeof(pthread_mutex_t), 0);
pthread_mutex_init(lmutex, 0); pthread_mutex_init(lmutex, 0);
return (long)lmutex; return (tbus)lmutex;
#endif #endif
} }
/*****************************************************************************/ /*****************************************************************************/
void APP_CC void APP_CC
tc_mutex_delete(long mutex) tc_mutex_delete(tbus mutex)
{ {
#if defined(_WIN32) #if defined(_WIN32)
CloseHandle((HANDLE)mutex); CloseHandle((HANDLE)mutex);
@ -106,7 +106,7 @@ tc_mutex_delete(long mutex)
/*****************************************************************************/ /*****************************************************************************/
int APP_CC int APP_CC
tc_mutex_lock(long mutex) tc_mutex_lock(tbus mutex)
{ {
#if defined(_WIN32) #if defined(_WIN32)
WaitForSingleObject((HANDLE)mutex, INFINITE); WaitForSingleObject((HANDLE)mutex, INFINITE);
@ -119,7 +119,7 @@ tc_mutex_lock(long mutex)
/*****************************************************************************/ /*****************************************************************************/
int APP_CC int APP_CC
tc_mutex_unlock(long mutex) tc_mutex_unlock(tbus mutex)
{ {
#if defined(_WIN32) #if defined(_WIN32)
ReleaseMutex((HANDLE)mutex); ReleaseMutex((HANDLE)mutex);
@ -131,26 +131,26 @@ tc_mutex_unlock(long mutex)
} }
/*****************************************************************************/ /*****************************************************************************/
long APP_CC tbus APP_CC
tc_sem_create(int init_count) tc_sem_create(int init_count)
{ {
#if defined(_WIN32) #if defined(_WIN32)
HANDLE sem; HANDLE sem;
sem = CreateSemaphore(0, init_count, init_count + 10, 0); sem = CreateSemaphore(0, init_count, init_count + 10, 0);
return (long)sem; return (tbus)sem;
#else #else
sem_t* sem; sem_t* sem;
sem = g_malloc(sizeof(sem_t), 0); sem = g_malloc(sizeof(sem_t), 0);
sem_init(sem, 0, init_count); sem_init(sem, 0, init_count);
return (long)sem; return (tbus)sem;
#endif #endif
} }
/*****************************************************************************/ /*****************************************************************************/
void APP_CC void APP_CC
tc_sem_delete(long sem) tc_sem_delete(tbus sem)
{ {
#if defined(_WIN32) #if defined(_WIN32)
CloseHandle((HANDLE)sem); CloseHandle((HANDLE)sem);
@ -165,7 +165,7 @@ tc_sem_delete(long sem)
/*****************************************************************************/ /*****************************************************************************/
int APP_CC int APP_CC
tc_sem_dec(long sem) tc_sem_dec(tbus sem)
{ {
#if defined(_WIN32) #if defined(_WIN32)
WaitForSingleObject((HANDLE)sem, INFINITE); WaitForSingleObject((HANDLE)sem, INFINITE);
@ -178,7 +178,7 @@ tc_sem_dec(long sem)
/*****************************************************************************/ /*****************************************************************************/
int APP_CC int APP_CC
tc_sem_inc(long sem) tc_sem_inc(tbus sem)
{ {
#if defined(_WIN32) #if defined(_WIN32)
ReleaseSemaphore((HANDLE)sem, 1, 0); ReleaseSemaphore((HANDLE)sem, 1, 0);

@ -30,23 +30,23 @@
int APP_CC int APP_CC
tc_thread_create(THREAD_RV (THREAD_CC * start_routine)(void*), void* arg); tc_thread_create(THREAD_RV (THREAD_CC * start_routine)(void*), void* arg);
long APP_CC tbus APP_CC
tc_get_threadid(void); tc_get_threadid(void);
long APP_CC tbus APP_CC
tc_mutex_create(void); tc_mutex_create(void);
void APP_CC void APP_CC
tc_mutex_delete(long mutex); tc_mutex_delete(tbus mutex);
int APP_CC int APP_CC
tc_mutex_lock(long mutex); tc_mutex_lock(tbus mutex);
int APP_CC int APP_CC
tc_mutex_unlock(long mutex); tc_mutex_unlock(tbus mutex);
long APP_CC tbus APP_CC
tc_sem_create(int init_count); tc_sem_create(int init_count);
void APP_CC void APP_CC
tc_sem_delete(long sem); tc_sem_delete(tbus sem);
int APP_CC int APP_CC
tc_sem_dec(long sem); tc_sem_dec(tbus sem);
int APP_CC int APP_CC
tc_sem_inc(long sem); tc_sem_inc(tbus sem);
#endif #endif

Loading…
Cancel
Save