Browse Source

Failed reads and writes on cgsem_post and cgsem_wait should be extremely rare.

ckolivas 12 years ago
parent
commit
104b14ec7f
1 changed files with 2 additions and 2 deletions
  1. 2 2
      util.c

+ 2 - 2
util.c

@@ -1898,7 +1898,7 @@ void cgsem_post(cgsem_t *cgsem)
 	int ret;
 	int ret;
 
 
 	ret = write(cgsem->pipefd[1], &buf, 1);
 	ret = write(cgsem->pipefd[1], &buf, 1);
-	if (ret == 0)
+	if (unlikely(ret == 0))
 		quit(1, "Failed to write in cgsem_post");
 		quit(1, "Failed to write in cgsem_post");
 }
 }
 
 
@@ -1908,7 +1908,7 @@ void cgsem_wait(cgsem_t *cgsem)
 	int ret;
 	int ret;
 
 
 	ret = read(cgsem->pipefd[0], &buf, 1);
 	ret = read(cgsem->pipefd[0], &buf, 1);
-	if (ret == 0)
+	if (unlikely(ret == 0))
 		quit(1, "Failed to read in cgsem_wait");
 		quit(1, "Failed to read in cgsem_wait");
 }
 }