Index: source/common/umutex.h |
diff --git a/source/common/umutex.h b/source/common/umutex.h |
index dba63b6ecf6bdcff111b9b4e8dde1f664bf36098..e0ad0d3c03654d61a023a082548563d8d4c03c61 100644 |
--- a/source/common/umutex.h |
+++ b/source/common/umutex.h |
@@ -1,6 +1,6 @@ |
/* |
********************************************************************** |
-* Copyright (C) 1997-2013, International Business Machines |
+* Copyright (C) 1997-2014, International Business Machines |
* Corporation and others. All Rights Reserved. |
********************************************************************** |
* |
@@ -27,6 +27,7 @@ |
// Forward Declarations. UMutex is not in the ICU namespace (yet) because |
// there are some remaining references from plain C. |
struct UMutex; |
+struct UConditionVar; |
U_NAMESPACE_BEGIN |
struct UInitOnce; |
@@ -320,7 +321,7 @@ U_NAMESPACE_END |
typedef struct UMutex { |
- icu::UInitOnce fInitOnce; |
+ icu::UInitOnce fInitOnce; |
CRITICAL_SECTION fCS; |
} UMutex; |
@@ -329,6 +330,14 @@ typedef struct UMutex { |
*/ |
#define U_MUTEX_INITIALIZER {U_INITONCE_INITIALIZER} |
+struct UConditionVar { |
+ HANDLE fEntryGate; |
+ HANDLE fExitGate; |
+ int32_t fWaitCount; |
+}; |
+ |
+#define U_CONDITION_INITIALIZER {NULL, NULL, 0} |
+ |
#elif U_PLATFORM_IMPLEMENTS_POSIX |
@@ -345,6 +354,11 @@ struct UMutex { |
typedef struct UMutex UMutex; |
#define U_MUTEX_INITIALIZER {PTHREAD_MUTEX_INITIALIZER} |
+struct UConditionVar { |
+ pthread_cond_t fCondition; |
+}; |
+#define U_CONDITION_INITIALIZER {PTHREAD_COND_INITIALIZER} |
+ |
#else |
/* |
@@ -379,5 +393,32 @@ U_INTERNAL void U_EXPORT2 umtx_lock(UMutex* mutex); |
*/ |
U_INTERNAL void U_EXPORT2 umtx_unlock (UMutex* mutex); |
+/* |
+ * Wait on a condition variable. |
+ * The calling thread will unlock the mutex and wait on the condition variable. |
+ * The mutex must be locked by the calling thread when invoking this function. |
+ * |
+ * @param cond the condition variable to wait on. |
+ * @param mutex the associated mutex. |
+ */ |
+ |
+U_INTERNAL void U_EXPORT2 umtx_condWait(UConditionVar *cond, UMutex *mutex); |
+ |
+ |
+/* |
+ * Broadcast wakeup of all threads waiting on a Condition. |
+ * The associated mutex must be locked by the calling thread when calling |
+ * this function; this is a temporary ICU restriction. |
+ * |
+ * @param cond the condition variable. |
+ */ |
+U_INTERNAL void U_EXPORT2 umtx_condBroadcast(UConditionVar *cond); |
+ |
+/* |
+ * Signal a condition variable, waking up one waiting thread. |
+ * CAUTION: Do not use. Place holder only. Not implemented for Windows. |
+ */ |
+U_INTERNAL void U_EXPORT2 umtx_condSignal(UConditionVar *cond); |
+ |
#endif /* UMUTEX_H */ |
/*eof*/ |