Closed maya-rv closed 5 years ago
cFE/OSAL bin-sem-flush-test segfaults. This might be a minimal test case of it.
#include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> static pthread_key_t msg_key; #define NUMTHREADS 4 void *thread_func(void *param) { pthread_setspecific(msg_key, param); return NULL; } int main(int argc, const char *argv[]) { pthread_t thread[NUMTHREADS]; int i; pthread_key_create(&msg_key, NULL); for (i=0; i <NUMTHREADS; ++i) { char * m = malloc(sizeof(char)); pthread_create(&thread[i], NULL, thread_func, m); } pthread_cancel(thread[0]); return 0; }
cFE/OSAL bin-sem-flush-test segfaults. This might be a minimal test case of it.