@@ -5,7 +5,7 @@
#include "runtime.h"
#include "malloc.h"
-Lock finlock;
+Lock finlock = LOCK_INITIALIZER;
// Finalizer hash table. Direct hash, linear scan, at most 3/4 full.
// Table size is power of 3 so that hash can be key % max.
@@ -14,7 +14,7 @@
typedef struct __go_open_array Slice;
// NOTE(rsc): Everything here could use cas if contention became an issue.
-static Lock proflock;
+static Lock proflock = LOCK_INITIALIZER;
// Per-call-stack allocation information.
// Lookup by hashing call stack into a linked-list hash table.
@@ -111,8 +111,8 @@
* mutual exclusion locks. in the uncontended case,
* as fast as spin locks (just a few user-level instructions),
* but on the contention path they sleep in the kernel.
- * a zeroed Lock is unlocked (no need to initialize each lock).
*/
+#define LOCK_INITIALIZER { PTHREAD_MUTEX_INITIALIZER }
void initlock(Lock*);
void lock(Lock*);
void unlock(Lock*);