From 269b40d027c828880336ee4203d212459808229f Mon Sep 17 00:00:00 2001 From: deadwood Date: Sat, 15 Nov 2014 19:52:17 +0000 Subject: [PATCH] compiler/pthread: make sure no pthread gets id equal to default value of type git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@49799 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- compiler/pthread/pthread.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/pthread/pthread.c b/compiler/pthread/pthread.c index 667443c26d..c65abf63bc 100644 --- a/compiler/pthread/pthread.c +++ b/compiler/pthread/pthread.c @@ -86,6 +86,8 @@ typedef struct struct MinList cleanup; } ThreadInfo; +#define PTHREAD_FIRST_THREAD_ID (1) /* First thread id will be 1 so that it is different than default value of pthread_t */ + static ThreadInfo threads[PTHREAD_THREADS_MAX]; //static volatile pthread_t nextid = 0; static struct SignalSemaphore thread_sem; @@ -117,7 +119,7 @@ static pthread_t GetThreadId(struct Task *task) ObtainSemaphore(&thread_sem); - for (i = 0; i < PTHREAD_THREADS_MAX; i++) + for (i = PTHREAD_FIRST_THREAD_ID; i < PTHREAD_THREADS_MAX; i++) { if ((struct Task *)threads[i].process == task) break; -- 2.11.4.GIT