#include <pthread.h>
typedef struct xbt_os_thread_ {
- /* KEEP IT IN SYNC WITH xbt_thread.c */
pthread_t t;
void *param;
pvoid_f_pvoid_t *start_routine;
THROW0(system_error,errcode,"pthread_setspecific failed for xbt_self_thread_key");
return t->start_routine(t->param);
}
-
xbt_os_thread_t xbt_os_thread_create(pvoid_f_pvoid_t start_routine,
void* param) {
int errcode;
void xbt_os_thread_yield(void) {
sched_yield();
}
+void xbt_os_thread_cancel(xbt_os_thread_t t) {
+ pthread_cancel(t->t);
+}
/****** mutex related functions ******/
typedef struct xbt_os_mutex_ {
/* KEEP IT IN SYNC WITH xbt_thread.c */
free(cond);
}
+void *xbt_os_thread_getparam(void) {
+ xbt_os_thread_t t = xbt_os_thread_self();
+ return t->param;
+}
+
/* ********************************* WINDOWS IMPLEMENTATION ************************************ */
#elif defined(WIN32)
typedef struct xbt_os_thread_ {
- /* KEEP IT IN SYNC WITH xbt_thread */
HANDLE handle; /* the win thread handle */
unsigned long id; /* the win thread id */
pvoid_f_pvoid_t *start_routine;
return TlsGetValue(xbt_self_thread_key);
}
+void *xbt_os_thread_getparam(void) {
+ xbt_os_thread_t t = xbt_os_thread_self();
+ return t->param;
+}
+
+
void xbt_os_thread_yield(void) {
Sleep(0);
}
+void xbt_os_thread_cancel(xbt_os_thread_t t) {
+ THROW_UNIMPLEMENTED;
+}
/****** mutex related functions ******/
typedef struct xbt_os_mutex_ {