Fix
authorTomas Mudrunka <tomas@mudrunka.cz>
Thu, 8 Jul 2021 12:53:48 +0000 (14:53 +0200)
committerTomas Mudrunka <tomas@mudrunka.cz>
Thu, 8 Jul 2021 12:53:48 +0000 (14:53 +0200)
c/pthread_extra/pthread_user_data.c

index 74ae1145c46511d7ed34021ee678fae8b1dede94..87055127dcd178921e68599a0c970b6f02aa2967 100644 (file)
@@ -1,5 +1,9 @@
 #define __PTHREAD_EXTRA_INTERNAL
 
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE //PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+#endif //_GNU_SOURCE
+
 //#include <stdio.h>
 #include <assert.h>
 #include <pthread.h>
@@ -35,6 +39,7 @@ pthread_user_data_internal_t* pthread_user_data_internal(pthread_t thread) {
        pthread_t i;
        for(i = 0; i<PTHREAD_XTHREADS_MAX; i++) {
                if(pthread_equal(pthread_user_data[i].tid, PTHREAD_XNULL)) {
+                       assert(((i+1)<PTHREAD_XTHREADS_MAX) && "FIXME: Pthread_extra user data table overflow!");
                        pthread_user_data[i+1].tid = PTHREAD_XNULL;
                        pthread_user_data[i].tid = thread;
                        pthread_user_data[i].running = 1; //NEW THREADS ARE RUNNING UNLESS PAUSED!
This page took 0.219759 seconds and 4 git commands to generate.