这段代码有什么问题?发布sem对象时,没问题。但是,只要它需要等待超时,我就会得到" futex工具返回了意外的错误代码"。
void* BackgroudProc(void*){
struct timespec ts;
while(1){
clock_gettime(CLOCK_REALTIME, &ts);
ts.tv_sec += 10;
sem_timedwait(&hFCRequestEvt, &ts);
for(int i = 0; i < requests.size(); i++){
if(numOfConnection >= MAX_CONNECTION)
break;
if(requests[i].state == QUEUED){
requests[i].state = STARTED;
numOfConnection++;
pthread_create(&requests[i].tid, 0, (void* (*)(void*))FileCopyFSM, (void*)(&requests[i]));
}
}
}
}