Commit 0c62c93a authored by Ian Lance Taylor's avatar Ian Lance Taylor

runtime/cgo: use PTHREAD_{MUTEX,COND}_INITIALIZER

Technically you must initialize static pthread_mutex_t and
pthread_cond_t variables with the appropriate INITIALIZER macro.  In
practice the default initializers are zero anyhow, but it's still good
code hygiene.

Change-Id: I517304b16c2c7943b3880855c1b47a9a506b4bdf
Reviewed-on: https://go-review.googlesource.com/9433Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
parent 339cf980
......@@ -10,8 +10,8 @@
#include <stdlib.h>
#include <string.h> // strerror
static pthread_cond_t runtime_init_cond;
static pthread_mutex_t runtime_init_mu;
static pthread_cond_t runtime_init_cond = PTHREAD_COND_INITIALIZER;
static pthread_mutex_t runtime_init_mu = PTHREAD_MUTEX_INITIALIZER;
static int runtime_init_done;
void
......@@ -39,4 +39,4 @@ x_cgo_notify_runtime_init_done(void* dummy) {
runtime_init_done = 1;
pthread_cond_broadcast(&runtime_init_cond);
pthread_mutex_unlock(&runtime_init_mu);
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment