summaryrefslogtreecommitdiff
path: root/innobase
diff options
context:
space:
mode:
Diffstat (limited to 'innobase')
-rw-r--r--innobase/configure.in3
-rw-r--r--innobase/include/lock0types.h1
-rw-r--r--innobase/include/os0file.h6
-rw-r--r--innobase/include/os0sync.h4
-rw-r--r--innobase/include/sync0types.h1
-rw-r--r--innobase/os/os0sync.c27
6 files changed, 32 insertions, 10 deletions
diff --git a/innobase/configure.in b/innobase/configure.in
index 1289f881344..ba95df0cc8c 100644
--- a/innobase/configure.in
+++ b/innobase/configure.in
@@ -1,5 +1,6 @@
# Process this file with autoconf to produce a configure script
-AC_INIT(./os/os0file.c)
+AC_INIT
+AM_MAINTAINER_MODE
AM_CONFIG_HEADER(ib_config.h)
AM_INIT_AUTOMAKE(ib, 0.90)
AC_PROG_CC
diff --git a/innobase/include/lock0types.h b/innobase/include/lock0types.h
index 705e64f6581..6c3e54ee1fc 100644
--- a/innobase/include/lock0types.h
+++ b/innobase/include/lock0types.h
@@ -9,6 +9,7 @@ Created 5/7/1996 Heikki Tuuri
#ifndef lock0types_h
#define lock0types_h
+#define lock_t ib_lock_t
typedef struct lock_struct lock_t;
typedef struct lock_sys_struct lock_sys_t;
diff --git a/innobase/include/os0file.h b/innobase/include/os0file.h
index 5b90f24f12e..a02cd947c28 100644
--- a/innobase/include/os0file.h
+++ b/innobase/include/os0file.h
@@ -28,6 +28,12 @@ Created 10/21/1995 Heikki Tuuri
#define POSIX_ASYNC_IO
#endif
+#ifndef S_IRWXU
+#define S_IRWXU 00700
+#define S_IRWXG 00070
+#define S_IRWXO 00007
+#endif
+
#endif
#ifdef __WIN__
diff --git a/innobase/include/os0sync.h b/innobase/include/os0sync.h
index dcf519fdb9d..a45f738f22b 100644
--- a/innobase/include/os0sync.h
+++ b/innobase/include/os0sync.h
@@ -25,8 +25,8 @@ struct os_event_struct {
fields */
ibool is_set; /* this is TRUE if the next mutex is
not reserved */
- os_fast_mutex_t wait_mutex; /* this mutex is used in waiting for
- the event */
+ pthread_cond_t cond_var; /* condition variable is used in
+ waiting for the event */
};
typedef struct os_event_struct os_event_struct_t;
typedef os_event_struct_t* os_event_t;
diff --git a/innobase/include/sync0types.h b/innobase/include/sync0types.h
index 2c31f80cca3..57478426f25 100644
--- a/innobase/include/sync0types.h
+++ b/innobase/include/sync0types.h
@@ -9,6 +9,7 @@ Created 9/5/1995 Heikki Tuuri
#ifndef sync0types_h
#define sync0types_h
+#define mutex_t ib_mutex_t
typedef struct mutex_struct mutex_t;
diff --git a/innobase/os/os0sync.c b/innobase/os/os0sync.c
index 1647dd982f3..4c283431575 100644
--- a/innobase/os/os0sync.c
+++ b/innobase/os/os0sync.c
@@ -60,9 +60,9 @@ os_event_create(
event = ut_malloc(sizeof(struct os_event_struct));
os_fast_mutex_init(&(event->os_mutex));
- os_fast_mutex_init(&(event->wait_mutex));
+ pthread_cond_init(&(event->cond_var), NULL);
- event->is_set = TRUE;
+ event->is_set = FALSE;
return(event);
#endif
@@ -119,8 +119,8 @@ os_event_set(
if (event->is_set) {
/* Do nothing */
} else {
- os_fast_mutex_unlock(&(event->wait_mutex));
event->is_set = TRUE;
+ pthread_cond_broadcast(&(event->cond_var));
}
os_fast_mutex_unlock(&(event->os_mutex));
@@ -148,7 +148,6 @@ os_event_reset(
if (!event->is_set) {
/* Do nothing */
} else {
- os_fast_mutex_lock(&(event->wait_mutex));
event->is_set = FALSE;
}
@@ -173,7 +172,7 @@ os_event_free(
ut_a(event);
os_fast_mutex_free(&(event->os_mutex));
- os_fast_mutex_free(&(event->wait_mutex));
+ pthread_cond_destroy(&(event->cond_var));
ut_free(event);
#endif
@@ -197,8 +196,22 @@ os_event_wait(
ut_a(err == WAIT_OBJECT_0);
#else
- os_fast_mutex_lock(&(event->wait_mutex));
- os_fast_mutex_unlock(&(event->wait_mutex));
+ os_fast_mutex_lock(&(event->os_mutex));
+loop:
+ if (event->is_set == TRUE) {
+ os_fast_mutex_unlock(&(event->os_mutex));
+
+ /* Ok, we may return */
+
+ return;
+ }
+
+ pthread_cond_wait(&(event->cond_var), &(event->os_mutex));
+
+ /* Solaris manual said that spurious wakeups may occur: we have
+ to check the 'is_set' variable again */
+
+ goto loop;
#endif
}