Browse Source

fix futex error handling

Colin Davidson 2 years ago
parent
commit
a58650728e
1 changed files with 2 additions and 0 deletions
  1. 2 0
      src/threading.cpp

+ 2 - 0
src/threading.cpp

@@ -562,6 +562,7 @@ gb_internal void tpool_wake_addr(Futex *addr) {
 		if (ret >= 0) {
 		if (ret >= 0) {
 			return;
 			return;
 		}
 		}
+		ret = -ret;
 		if (ret == EINTR || ret == EFAULT) {
 		if (ret == EINTR || ret == EFAULT) {
 			continue;
 			continue;
 		}
 		}
@@ -581,6 +582,7 @@ gb_internal void tpool_wait_on_addr(Futex *addr, Footex val) {
 			}
 			}
 			continue;
 			continue;
 		}
 		}
+		ret = -ret;
 		if (ret == EINTR || ret == EFAULT) {
 		if (ret == EINTR || ret == EFAULT) {
 			continue;
 			continue;
 		}
 		}