Can anyone please tell me why I have segmentation fault here?
void *dispatcher_threadloop(void * queue){
//thread loop of the dispatch thread- pass the tast to one of worker thread
dispatch_queue_t *dQueue;
printf("message-boss1");
dQueue = (dispatch_queue_t *)queue;
if (dQueue->HEAD!=NULL){
for(;;){
sem_wait(dQueue->queue_thread_semaphore);
//TODO
}
}
printf("message-boss2");
}
queueis probably 0 or points to some invalid location in memory.If you want more help, see http://sscce.org/