native threads - there was something missing
authorstefan <none@none>
Wed, 5 May 2004 12:24:34 +0000 (12:24 +0000)
committerstefan <none@none>
Wed, 5 May 2004 12:24:34 +0000 (12:24 +0000)
src/threads/native/threads.c
src/threads/native/threads.h
threads/nativethread.c
threads/nativethread.h

index 0e6b4123e6a67844aef55958f40c3c09ab184946..d9e769e535cdd175189ea458cad45b2e56f862b8 100644 (file)
@@ -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);
 
index a4d1b9c844518595efda5166a4195e595b6c01c6..7bc12770eae7ffe7a3ea5e2a00cf794ab8472fb3 100644 (file)
@@ -97,6 +97,7 @@ typedef struct {
 } threadcritnode;
 
 void thread_registercritical(threadcritnode *);
+u1 *thread_checkcritical(u1*);
 
 extern volatile int stopworldwhere;
 
index 0e6b4123e6a67844aef55958f40c3c09ab184946..d9e769e535cdd175189ea458cad45b2e56f862b8 100644 (file)
@@ -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);
 
index a4d1b9c844518595efda5166a4195e595b6c01c6..7bc12770eae7ffe7a3ea5e2a00cf794ab8472fb3 100644 (file)
@@ -97,6 +97,7 @@ typedef struct {
 } threadcritnode;
 
 void thread_registercritical(threadcritnode *);
+u1 *thread_checkcritical(u1*);
 
 extern volatile int stopworldwhere;