X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/611d822b02f836d7abe031cced6adc4281ef4356..cf0ebedfe4a6fd8a14784135e912725b7e027d6f:/src/xbt/xbt_os_thread.c diff --git a/src/xbt/xbt_os_thread.c b/src/xbt/xbt_os_thread.c index 3b58603ffa..79242cdf5a 100644 --- a/src/xbt/xbt_os_thread.c +++ b/src/xbt/xbt_os_thread.c @@ -246,35 +246,6 @@ xbt_os_thread_t xbt_os_thread_self(void ) return pthread_getspecific(xbt_self_thread_key); } -void xbt_os_thread_key_create(xbt_os_thread_key_t* key) -{ - int errcode = pthread_key_create(key, NULL); - xbt_assert(errcode==0 , "pthread_key_create failed"); -} - -void xbt_os_thread_key_destroy(xbt_os_thread_key_t key) -{ - int errcode = pthread_key_delete(key); - xbt_assert(errcode == 0, "pthread_key_delete failed"); -} - -void xbt_os_thread_set_specific(xbt_os_thread_key_t key, void* value) -{ - int errcode = pthread_setspecific(key, value); - xbt_assert(errcode==0, "pthread_setspecific failed"); -} - -void* xbt_os_thread_get_specific(xbt_os_thread_key_t key) -{ - return pthread_getspecific(key); -} - -#include -void xbt_os_thread_yield(void) -{ - sched_yield(); -} - /****** mutex related functions ******/ typedef struct xbt_os_mutex_ { pthread_mutex_t m; @@ -318,47 +289,6 @@ void xbt_os_mutex_destroy(xbt_os_mutex_t mutex) free(mutex); } -/***** condition related functions *****/ -typedef struct xbt_os_cond_ { - pthread_cond_t c; -} s_xbt_os_cond_t; - -xbt_os_cond_t xbt_os_cond_init(void) -{ - xbt_os_cond_t res = xbt_new(s_xbt_os_cond_t, 1); - int errcode = pthread_cond_init(&(res->c), NULL); - xbt_assert(errcode==0, "pthread_cond_init() failed: %s", strerror(errcode)); - return res; -} - -void xbt_os_cond_wait(xbt_os_cond_t cond, xbt_os_mutex_t mutex) -{ - int errcode = pthread_cond_wait(&(cond->c), &(mutex->m)); - xbt_assert(errcode==0, "pthread_cond_wait(%p,%p) failed: %s", cond, mutex, strerror(errcode)); -} - -void xbt_os_cond_signal(xbt_os_cond_t cond) -{ - int errcode = pthread_cond_signal(&(cond->c)); - xbt_assert(errcode==0, "pthread_cond_signal(%p) failed: %s", cond, strerror(errcode)); -} - -void xbt_os_cond_broadcast(xbt_os_cond_t cond) -{ - int errcode = pthread_cond_broadcast(&(cond->c)); - xbt_assert(errcode==0, "pthread_cond_broadcast(%p) failed: %s", cond, strerror(errcode)); -} - -void xbt_os_cond_destroy(xbt_os_cond_t cond) -{ - if (!cond) - return; - - int errcode = pthread_cond_destroy(&(cond->c)); - xbt_assert(errcode==0, "pthread_cond_destroy(%p) failed: %s", cond, strerror(errcode)); - free(cond); -} - typedef struct xbt_os_sem_ { #if !HAVE_SEM_INIT char *name;