From c4f375f2f4f1ced9c4f395ac77b9753e849062d2 Mon Sep 17 00:00:00 2001 From: stefan Date: Wed, 5 May 2004 12:24:34 +0000 Subject: [PATCH] native threads - there was something missing --- src/threads/native/threads.c | 7 ++----- src/threads/native/threads.h | 1 + threads/nativethread.c | 7 ++----- threads/nativethread.h | 1 + 4 files changed, 6 insertions(+), 10 deletions(-) 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; -- 2.25.1