summaryrefslogtreecommitdiff
path: root/compat/win32/pthread.h
diff options
context:
space:
mode:
authorJohannes Sixt <j6t@kdbg.org>2010-01-29 23:54:05 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-01-30 03:42:40 (GMT)
commit947c3464e49522c55296a8191aed7946bd0f4308 (patch)
tree2a8aa77ee10f163641c2c67776f81ce7e4547d9d /compat/win32/pthread.h
parenta004fb923d74c1d5500d493506b1462eb04cf017 (diff)
downloadgit-947c3464e49522c55296a8191aed7946bd0f4308.zip
git-947c3464e49522c55296a8191aed7946bd0f4308.tar.gz
git-947c3464e49522c55296a8191aed7946bd0f4308.tar.bz2
Implement pthread_cond_broadcast on Windows
See http://www.cse.wustl.edu/~schmidt/win32-cv-1.html, section "The SignalObjectAndWait solution". But note that this implementation does not use SignalObjectAndWait (which is needed to achieve fairness, but we do not need fairness). Note that our implementations of pthread_cond_broadcast and pthread_cond_signal require that they are invoked with the mutex held that is used in the pthread_cond_wait calls. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/win32/pthread.h')
-rw-r--r--compat/win32/pthread.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/compat/win32/pthread.h b/compat/win32/pthread.h
index b8e1bcb..c72f100 100644
--- a/compat/win32/pthread.h
+++ b/compat/win32/pthread.h
@@ -32,17 +32,18 @@
* See also: http://www.cse.wustl.edu/~schmidt/win32-cv-1.html
*/
typedef struct {
- volatile LONG waiters;
+ LONG waiters;
+ int was_broadcast;
+ CRITICAL_SECTION waiters_lock;
HANDLE sema;
+ HANDLE continue_broadcast;
} pthread_cond_t;
extern int pthread_cond_init(pthread_cond_t *cond, const void *unused);
-
extern int pthread_cond_destroy(pthread_cond_t *cond);
-
extern int pthread_cond_wait(pthread_cond_t *cond, CRITICAL_SECTION *mutex);
-
extern int pthread_cond_signal(pthread_cond_t *cond);
+extern int pthread_cond_broadcast(pthread_cond_t *cond);
/*
* Simple thread creation implementation using pthread API