summaryrefslogtreecommitdiff
path: root/include/my_semaphore.h
diff options
context:
space:
mode:
authormonty@hundin.mysql.fi <>2002-06-29 00:16:15 +0300
committermonty@hundin.mysql.fi <>2002-06-29 00:16:15 +0300
commit8fa3c789f65809e380b7b2f574571aa0ce624445 (patch)
tree4ad1a20d59a1252f985bb184bc8e51fc1988c045 /include/my_semaphore.h
parent578a9d9901fe19723a028854b6d2774a778c0740 (diff)
downloadmariadb-git-8fa3c789f65809e380b7b2f574571aa0ce624445.tar.gz
Added support for semaphores in mysys.
(Needed for query cache for systems which doesn't have native semaphores)
Diffstat (limited to 'include/my_semaphore.h')
-rw-r--r--include/my_semaphore.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/include/my_semaphore.h b/include/my_semaphore.h
index 36c4b1a4740..aecbde09511 100644
--- a/include/my_semaphore.h
+++ b/include/my_semaphore.h
@@ -33,20 +33,29 @@
C_MODE_START
-#ifndef __WIN__
+#ifdef HAVE_SEMAPHORE_H
#include <semaphore.h>
#else
+#ifdef __WIN__
typedef HANDLE sem_t;
+#else
+typedef struct {
+ pthread_mutex_t mutex;
+ pthread_cond_t cond;
+ uint count;
+} sem_t;
+#endif
+
int sem_init(sem_t * sem, int pshared, unsigned int value);
int sem_destroy(sem_t * sem);
int sem_trywait(sem_t * sem);
int sem_wait(sem_t * sem);
int sem_post(sem_t * sem);
-int sem_post_multiple(sem_t * sem,int count);
-int sem_getvalue(sem_t * sem, int * sval);
+int sem_post_multiple(sem_t * sem, unsigned int count);
+int sem_getvalue(sem_t * sem, unsigned int * sval);
-#endif /* __WIN__ */
+#endif
C_MODE_END
#endif /* !_my_semaphore_h_ */