c,分段错误

Lea*_*nne 0 c if-statement segmentation-fault

任何人都可以告诉我为什么我在这里有分段错误?

   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");

}
Run Code Online (Sandbox Code Playgroud)

Dav*_*son 5

queue 可能是0或指向内存中的某个无效位置.

如果您需要更多帮助,请参阅http://sscce.org/