From: stefan Date: Wed, 5 May 2004 12:24:34 +0000 (+0000) Subject: native threads - there was something missing X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=c4f375f2f4f1ced9c4f395ac77b9753e849062d2;hp=bebf3989bcdf8913ddb8b1bc2f599d04400cb0c9;p=cacao.git native threads - there was something missing --- diff --git a/src/threads/native/threads.c b/src/threads/native/threads.c index 0e6b4123e..d9e769e53 100644 --- a/src/threads/native/threads.c +++ b/src/threads/native/threads.c @@ -126,7 +126,7 @@ void thread_registercritical(threadcritnode *n) avl_insert(criticaltree, n); } -static u1 *thread_checkcritical(u1 *mcodeptr) +u1 *thread_checkcritical(u1 *mcodeptr) { const threadcritnode *n = findcritical(mcodeptr); return (n && mcodeptr < n->mcodeend && mcodeptr > n->mcodebegin) ? n->mcoderestart : NULL; @@ -203,10 +203,7 @@ static void sigsuspend_handler(ucontext_t *ctx) sigset_t sigs; void *critical; -#ifdef __I386__ - if ((critical = thread_checkcritical((void*) ctx->uc_mcontext.gregs[REG_EIP])) != NULL) - ctx->uc_mcontext.gregs[REG_EIP] = (long) critical; -#endif + thread_restartcriticalsection(ctx); sem_post(&suspend_ack); diff --git a/src/threads/native/threads.h b/src/threads/native/threads.h index a4d1b9c84..7bc12770e 100644 --- a/src/threads/native/threads.h +++ b/src/threads/native/threads.h @@ -97,6 +97,7 @@ typedef struct { } threadcritnode; void thread_registercritical(threadcritnode *); +u1 *thread_checkcritical(u1*); extern volatile int stopworldwhere; diff --git a/threads/nativethread.c b/threads/nativethread.c index 0e6b4123e..d9e769e53 100644 --- a/threads/nativethread.c +++ b/threads/nativethread.c @@ -126,7 +126,7 @@ void thread_registercritical(threadcritnode *n) avl_insert(criticaltree, n); } -static u1 *thread_checkcritical(u1 *mcodeptr) +u1 *thread_checkcritical(u1 *mcodeptr) { const threadcritnode *n = findcritical(mcodeptr); return (n && mcodeptr < n->mcodeend && mcodeptr > n->mcodebegin) ? n->mcoderestart : NULL; @@ -203,10 +203,7 @@ static void sigsuspend_handler(ucontext_t *ctx) sigset_t sigs; void *critical; -#ifdef __I386__ - if ((critical = thread_checkcritical((void*) ctx->uc_mcontext.gregs[REG_EIP])) != NULL) - ctx->uc_mcontext.gregs[REG_EIP] = (long) critical; -#endif + thread_restartcriticalsection(ctx); sem_post(&suspend_ack); diff --git a/threads/nativethread.h b/threads/nativethread.h index a4d1b9c84..7bc12770e 100644 --- a/threads/nativethread.h +++ b/threads/nativethread.h @@ -97,6 +97,7 @@ typedef struct { } threadcritnode; void thread_registercritical(threadcritnode *); +u1 *thread_checkcritical(u1*); extern volatile int stopworldwhere;