COPT=-g -O2 -flto -ftree-vectorize -ftree-slp-vectorize -fvisibility=hidden -D_FORTIFY_SOURCE=2 -DMG_ENABLE_FS=0 -fstack-protector-strong -fno-delete-null-pointer-checks $(CARCH)\r
-#COPT=-fvisibility=hidden -DMG_ENABLE_FS=0 -fstack-protector-strong $(CARCH)\r
+#COPT=-g -fvisibility=hidden -DMG_ENABLE_FS=0 -fstack-protector-strong $(CARCH)\r
CDEF=-D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE=1 -D_GNU_SOURCE\r
CERR=-Wall -Wextra -Werror -pedantic -Werror=date-time -Wformat-security -Wduplicated-cond -Wfloat-equal -Wshadow -Wlogical-not-parentheses -Wnull-dereference\r
\r
### Components
+ * pthread_pause - implements suspend/resume functionality for pthreads (no know issues, recently fixed some deadlocks, but not really tested)
* pthread_msgqueue - implements message queues, more features than POSIX mqueue (no known issues, but not really tested)
* pthread_user_data - allows user to store and retreive custom data using thread handle as a key (suboptimal, used internaly, not tested)
- * pthread_multi - lock multiple mutexes at once (might cause deadlocks in complex scenarios)
- * pthread_pause - implements suspend/resume functionality for pthreads (causes deadlocks under high load)
+ * pthread_multi - lock multiple mutexes at once (might cause deadlocks in complex scenarios???)
sigset_t sigset;
sigfillset(&sigset);
sigdelset(&sigset, PTHREAD_XSIG_STOP);
- while(!pthread_user_data_internal(pthread_self())->running) {
+ if(!pthread_user_data_internal(pthread_self())->running) {
sigsuspend(&sigset);
}
}
//That way you can be sure it is pausable immediately
pthread_create(&a, NULL, thread_test, " A");
pthread_create(&b, NULL, thread_test, " B");
+ //sleep(1);
+
+ //printf("OK\n");
+ /*
+ for(int32_t i = 1;i>0;i++) {
+ pthread_pause(a);
+ pthread_pause(a);
+ pthread_unpause(a);
+ pthread_unpause(a);
+ }
+ */
+ /*
+ exit(23);
+ pthread_pause(a);
+ pthread_unpause(b);
+ */
while(1) {
pthread_pause(b);