only use mach kernel semaphores for actual contention.
running rob's powser p.go:
3.21u 2.58s 5.80r 6.out # old
1.48u 0.05s 1.54r 6.out # new
R=r
OCL=15748
CL=15750
diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h
index 3d439ca..411b604 100644
--- a/src/runtime/runtime.h
+++ b/src/runtime/runtime.h
@@ -43,6 +43,7 @@
typedef struct Lock Lock;
typedef union Note Note;
typedef struct Mem Mem;
+typedef struct Usema Usema;
/*
* per cpu declaration
@@ -77,6 +78,11 @@
uint32 key;
uint32 sema; // for OS X
};
+struct Usema
+{
+ uint32 u;
+ uint32 k;
+};
union Note
{
struct { // Linux
@@ -84,7 +90,7 @@
};
struct { // OS X
int32 wakeup;
- uint32 sema;
+ Usema sema;
};
};
struct String