summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
f0cf99d)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@3741
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
XBT_PUBLIC(xbt_thread_t) xbt_thread_self(void);
/* xbt_thread_join frees the joined thread (ie the XBT wrapper around it, the OS frees the rest) */
XBT_PUBLIC(void) xbt_thread_join(xbt_thread_t thread);
XBT_PUBLIC(xbt_thread_t) xbt_thread_self(void);
/* xbt_thread_join frees the joined thread (ie the XBT wrapper around it, the OS frees the rest) */
XBT_PUBLIC(void) xbt_thread_join(xbt_thread_t thread);
- /* Brutally ends the life of the poor victim */
- XBT_PUBLIC(void) xbt_thread_destroy(xbt_thread_t thread);
+ /* Ends the life of the poor victim (not always working if it's computing, but working if it's blocked in the OS) */
+ XBT_PUBLIC(void) xbt_thread_cancel(xbt_thread_t thread);
/* suicide */
XBT_PUBLIC(void) xbt_thread_exit(void);
/* current thread pass control to any possible thread wanting it */
/* suicide */
XBT_PUBLIC(void) xbt_thread_exit(void);
/* current thread pass control to any possible thread wanting it */
THROW0(system_error,errcode,"pthread_setspecific failed for xbt_self_thread_key");
return t->start_routine(t->param);
}
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;
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_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 */
/****** mutex related functions ******/
typedef struct xbt_os_mutex_ {
/* KEEP IT IN SYNC WITH xbt_thread.c */
void xbt_os_thread_yield(void) {
Sleep(0);
}
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_ {
/****** mutex related functions ******/
typedef struct xbt_os_mutex_ {
void xbt_thread_yield(void) {
xbt_os_thread_yield();
}
void xbt_thread_yield(void) {
xbt_os_thread_yield();
}
+void xbt_thread_cancel(xbt_thread_t t) {
+ xbt_os_thread_cancel(t->os_thread);
+}
/****** mutex related functions ******/
struct xbt_mutex_ {
/* KEEP IT IN SYNC WITH OS IMPLEMENTATION (both win and lin) */
/****** mutex related functions ******/
struct xbt_mutex_ {
/* KEEP IT IN SYNC WITH OS IMPLEMENTATION (both win and lin) */
-xbt_thread_destroy(xbt_thread_t thread) {
+xbt_thread_cancel(xbt_thread_t thread) {
SIMIX_process_kill(thread->s_process);
free(thread);
}
void xbt_thread_exit() {
SIMIX_process_kill(thread->s_process);
free(thread);
}
void xbt_thread_exit() {
- xbt_thread_destroy(xbt_thread_self());
+ xbt_thread_t me=SIMIX_process_get_data(SIMIX_process_self());
+ SIMIX_process_kill(me->s_process);
+ free(me);
}
xbt_thread_t xbt_thread_self(void) {
}
xbt_thread_t xbt_thread_self(void) {