2011-08-10 4 views
0

누구나 내가 왜 세분화 오류가 발생했는지 말해 줄 수 있습니까?c, 세분화 오류

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

} 
+3

디버거를 사용해 보셨습니까? –

답변

5

queue은 아마도 0이거나 메모리의 잘못된 위치를 나타냅니다.

도움이 더 원하는 경우 널 (null)에 대해 dQueue을 확인하는 기분하지 않는 경우, http://sscce.org/

2

를 참조하거나 dQueue되는 널 (null)이 발생해서는 안 경우, 다른 한편으로 주장

dispatch_queue_t *dQueue = queue; 

assert(dQueue!=NULL) 

시도 아마 queue 변수의 출처를 게시해야합니다.

+0

그냥 질문에 의해 업데이 트되었습니다 – Leanne

+0

난 그때 단언과 함께 간다. – Tom

+0

흠, 시도했지만 작동하지 않습니다 .. – Leanne

관련 문제