1
0
mirror of https://github.com/fumiama/simple-kanban.git synced 2026-06-29 23:51:09 +08:00

fix busywait in el7

This commit is contained in:
源文雨
2022-10-26 15:22:31 +08:00
parent 277b7f0978
commit a7c66c34a7

View File

@@ -62,7 +62,7 @@ static int kanb_file_ro_cnt, data_file_ro_cnt;
#define MAXWAITSEC 16 #define MAXWAITSEC 16
#define TIMERDATSZ BUFSIZ #define TIMERDATSZ BUFSIZ
static struct timeval timeout = {MAXWAITSEC/4, 0}; static struct timeval timeout;
// accept_timer 使用的结构体 // accept_timer 使用的结构体
// 包含了本次 accept 的全部信息 // 包含了本次 accept 的全部信息
@@ -128,6 +128,7 @@ static void accept_client() {
FD_COPY(&tmpfds, &rdfds); FD_COPY(&tmpfds, &rdfds);
FD_COPY(&tmpfds, &erfds); FD_COPY(&tmpfds, &erfds);
puts("Selecting..."); puts("Selecting...");
timeout.tv_sec = MAXWAITSEC/4;
int r = select(THREADCNT+8, &rdfds, &wrfds, &erfds, &timeout); int r = select(THREADCNT+8, &rdfds, &wrfds, &erfds, &timeout);
if(r < 0) { if(r < 0) {
perror("select"); perror("select");