Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: source/common/umutex.h

Issue 845603002: Update ICU to 54.1 step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@master
Patch Set: remove unusued directories Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/common/ulocimp.h ('k') | source/common/umutex.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 ********************************************************************** 2 **********************************************************************
3 * Copyright (C) 1997-2013, International Business Machines 3 * Copyright (C) 1997-2014, International Business Machines
4 * Corporation and others. All Rights Reserved. 4 * Corporation and others. All Rights Reserved.
5 ********************************************************************** 5 **********************************************************************
6 * 6 *
7 * File UMUTEX.H 7 * File UMUTEX.H
8 * 8 *
9 * Modification History: 9 * Modification History:
10 * 10 *
11 * Date Name Description 11 * Date Name Description
12 * 04/02/97 aliu Creation. 12 * 04/02/97 aliu Creation.
13 * 04/07/99 srl rewrite - C interface, multiple mutices 13 * 04/07/99 srl rewrite - C interface, multiple mutices
14 * 05/13/99 stephen Changed to umutex (from cmutex) 14 * 05/13/99 stephen Changed to umutex (from cmutex)
15 ****************************************************************************** 15 ******************************************************************************
16 */ 16 */
17 17
18 #ifndef UMUTEX_H 18 #ifndef UMUTEX_H
19 #define UMUTEX_H 19 #define UMUTEX_H
20 20
21 #include "unicode/utypes.h" 21 #include "unicode/utypes.h"
22 #include "unicode/uclean.h" 22 #include "unicode/uclean.h"
23 #include "putilimp.h" 23 #include "putilimp.h"
24 24
25 25
26 26
27 // Forward Declarations. UMutex is not in the ICU namespace (yet) because 27 // Forward Declarations. UMutex is not in the ICU namespace (yet) because
28 // there are some remaining references from plain C. 28 // there are some remaining references from plain C.
29 struct UMutex; 29 struct UMutex;
30 struct UConditionVar;
30 31
31 U_NAMESPACE_BEGIN 32 U_NAMESPACE_BEGIN
32 struct UInitOnce; 33 struct UInitOnce;
33 U_NAMESPACE_END 34 U_NAMESPACE_END
34 35
35 // Stringify macros, to allow #include of user supplied atomic & mutex files. 36 // Stringify macros, to allow #include of user supplied atomic & mutex files.
36 #define U_MUTEX_STR(s) #s 37 #define U_MUTEX_STR(s) #s
37 #define U_MUTEX_XSTR(s) U_MUTEX_STR(s) 38 #define U_MUTEX_XSTR(s) U_MUTEX_STR(s)
38 39
39 /**************************************************************************** 40 /****************************************************************************
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 # define NOSERVICE 314 # define NOSERVICE
314 # define NOIME 315 # define NOIME
315 # define NOMCX 316 # define NOMCX
316 # ifndef NOMINMAX 317 # ifndef NOMINMAX
317 # define NOMINMAX 318 # define NOMINMAX
318 # endif 319 # endif
319 # include <windows.h> 320 # include <windows.h>
320 321
321 322
322 typedef struct UMutex { 323 typedef struct UMutex {
323 icu::UInitOnce fInitOnce; 324 icu::UInitOnce fInitOnce;
324 CRITICAL_SECTION fCS; 325 CRITICAL_SECTION fCS;
325 } UMutex; 326 } UMutex;
326 327
327 /* Initializer for a static UMUTEX. Deliberately contains no value for the 328 /* Initializer for a static UMUTEX. Deliberately contains no value for the
328 * CRITICAL_SECTION. 329 * CRITICAL_SECTION.
329 */ 330 */
330 #define U_MUTEX_INITIALIZER {U_INITONCE_INITIALIZER} 331 #define U_MUTEX_INITIALIZER {U_INITONCE_INITIALIZER}
331 332
333 struct UConditionVar {
334 HANDLE fEntryGate;
335 HANDLE fExitGate;
336 int32_t fWaitCount;
337 };
338
339 #define U_CONDITION_INITIALIZER {NULL, NULL, 0}
340
332 341
333 342
334 #elif U_PLATFORM_IMPLEMENTS_POSIX 343 #elif U_PLATFORM_IMPLEMENTS_POSIX
335 344
336 /* 345 /*
337 * POSIX platform 346 * POSIX platform
338 */ 347 */
339 348
340 #include <pthread.h> 349 #include <pthread.h>
341 350
342 struct UMutex { 351 struct UMutex {
343 pthread_mutex_t fMutex; 352 pthread_mutex_t fMutex;
344 }; 353 };
345 typedef struct UMutex UMutex; 354 typedef struct UMutex UMutex;
346 #define U_MUTEX_INITIALIZER {PTHREAD_MUTEX_INITIALIZER} 355 #define U_MUTEX_INITIALIZER {PTHREAD_MUTEX_INITIALIZER}
347 356
357 struct UConditionVar {
358 pthread_cond_t fCondition;
359 };
360 #define U_CONDITION_INITIALIZER {PTHREAD_COND_INITIALIZER}
361
348 #else 362 #else
349 363
350 /* 364 /*
351 * Unknow platform type. 365 * Unknow platform type.
352 * This is an error condition. ICU requires mutexes. 366 * This is an error condition. ICU requires mutexes.
353 */ 367 */
354 368
355 #error Unknown Platform. 369 #error Unknown Platform.
356 370
357 #endif 371 #endif
(...skipping 14 matching lines...) Expand all
372 * and may cause a deadlock on some platforms. 386 * and may cause a deadlock on some platforms.
373 */ 387 */
374 U_INTERNAL void U_EXPORT2 umtx_lock(UMutex* mutex); 388 U_INTERNAL void U_EXPORT2 umtx_lock(UMutex* mutex);
375 389
376 /* Unlock a mutex. 390 /* Unlock a mutex.
377 * @param mutex The given mutex to be unlocked. Pass NULL to specify 391 * @param mutex The given mutex to be unlocked. Pass NULL to specify
378 * the global ICU mutex. 392 * the global ICU mutex.
379 */ 393 */
380 U_INTERNAL void U_EXPORT2 umtx_unlock (UMutex* mutex); 394 U_INTERNAL void U_EXPORT2 umtx_unlock (UMutex* mutex);
381 395
396 /*
397 * Wait on a condition variable.
398 * The calling thread will unlock the mutex and wait on the condition variable.
399 * The mutex must be locked by the calling thread when invoking this function.
400 *
401 * @param cond the condition variable to wait on.
402 * @param mutex the associated mutex.
403 */
404
405 U_INTERNAL void U_EXPORT2 umtx_condWait(UConditionVar *cond, UMutex *mutex);
406
407
408 /*
409 * Broadcast wakeup of all threads waiting on a Condition.
410 * The associated mutex must be locked by the calling thread when calling
411 * this function; this is a temporary ICU restriction.
412 *
413 * @param cond the condition variable.
414 */
415 U_INTERNAL void U_EXPORT2 umtx_condBroadcast(UConditionVar *cond);
416
417 /*
418 * Signal a condition variable, waking up one waiting thread.
419 * CAUTION: Do not use. Place holder only. Not implemented for Windows.
420 */
421 U_INTERNAL void U_EXPORT2 umtx_condSignal(UConditionVar *cond);
422
382 #endif /* UMUTEX_H */ 423 #endif /* UMUTEX_H */
383 /*eof*/ 424 /*eof*/
OLDNEW
« no previous file with comments | « source/common/ulocimp.h ('k') | source/common/umutex.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698