25ms seems like a good timeout
This commit is contained in:
parent
d7284d5cb8
commit
139fe5a045
|
@ -85,7 +85,7 @@ const u32 kReplyStart = kQueueSize / 2;
|
||||||
const u32 kPacketEnd = kReplyStart;
|
const u32 kPacketEnd = kReplyStart;
|
||||||
const u32 kReplyEnd = kQueueSize;
|
const u32 kReplyEnd = kQueueSize;
|
||||||
|
|
||||||
const int RecvTimeout = 500;
|
const int RecvTimeout = 25;
|
||||||
|
|
||||||
int LastHostID;
|
int LastHostID;
|
||||||
|
|
||||||
|
@ -214,12 +214,12 @@ bool SemWait(int num, int timeout)
|
||||||
{
|
{
|
||||||
if (!timeout)
|
if (!timeout)
|
||||||
return sem_trywait(SemPool[num]) == 0;
|
return sem_trywait(SemPool[num]) == 0;
|
||||||
|
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
clock_gettime(CLOCK_REALTIME, &ts);
|
clock_gettime(CLOCK_REALTIME, &ts);
|
||||||
ts.tv_nsec += timeout * 1000000;
|
ts.tv_nsec += timeout * 1000000;
|
||||||
long sec = ts.tv_nsec / 1000000000;
|
long sec = ts.tv_nsec / 1000000000;
|
||||||
ts.tv_nsec -= sec * 1000000000;
|
ts.tv_nsec -= sec * 1000000000;
|
||||||
ts.tv_sec += sec;
|
ts.tv_sec += sec;
|
||||||
|
|
||||||
return sem_timedwait(SemPool[num], &ts) == 0;
|
return sem_timedwait(SemPool[num], &ts) == 0;
|
||||||
|
|
Loading…
Reference in New Issue