小弟用下面的程序段,来测试 超时错ETIMEDOUT,但是,实际测试,得到的错一直是errno=4,Interrupted function call 错。我的程序是不是有什么地方写错了啊??
sprintf(buf,“mq 9 %03d\n”,k);
clock_gettime(CLOCK_REALTIME, &tm);
tm.tv_sec += 1;
if((res=mq_timedsend(msgQId, buf, strlen(buf), prio, &tm)) < 0) {//res=0->ok
save_errno = errno;
fprintf(stderr,"\nmsgQSend failed[%d]!!",save_errno);
if(save_errno == ETIMEDOUT){
printf("\nETIMEDOUT");
sleep(5);
}
}
else
{k++;}