Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

umutex.h

Go to the documentation of this file.
00001 /*
00002 **********************************************************************
00003 *   Copyright (C) 1997-1999, International Business Machines
00004 *   Corporation and others.  All Rights Reserved.
00005 **********************************************************************
00006 *
00007 * File UMUTEX.H
00008 *
00009 * Modification History:
00010 *
00011 *   Date        Name        Description
00012 *   04/02/97  aliu        Creation.
00013 *   04/07/99  srl         rewrite - C interface, multiple mutices
00014 *   05/13/99  stephen     Changed to umutex (from cmutex)
00015 ********************************************************************************
00016 */
00017 
00018 #ifndef UMUTEX_H
00019 #define UMUTEX_H
00020 
00021 #include "unicode/utypes.h"
00022 
00023 #ifndef XP_CPLUSPLUS
00024 typedef void * Mutex;
00025 #endif
00026 
00027 /*
00028  * Code within this library which accesses protected data should
00029  * instantiate a Mutex object while doing so.  Notice that there is
00030  * only one coarse-grained lock which applies to this entire library,
00031  * so keep locking short and sweet.
00032  *
00033  * For example:
00034  *
00035  * void Function(int arg1, int arg2)
00036  * {
00037  *   static Object* foo; // Shared read-write object
00038  *   Mutex mutex;
00039  *   foo->Method();
00040  *   // When 'mutex' goes out of scope and gets destroyed here
00041  *   // the lock is released
00042  * }
00043  *
00044  * Note: Do NOT use the form 'Mutex mutex();' as that merely
00045  * forward-declares a function returning a Mutex. This is a common
00046  * mistake which silently slips through the compiler!!  */
00047 
00048 
00049 /* Lock a mutex. Pass in NULL if you want the (ick) Single Global
00050    Mutex. */
00051 U_CAPI void  U_EXPORT2 umtx_lock   ( UMTX* mutex ); 
00052 
00053 /* Unlock a mutex. Pass in NULL if you want the single global
00054    mutex. */
00055 U_CAPI void U_EXPORT2 umtx_unlock ( UMTX* mutex );
00056 
00057 /* Initialize a mutex. Use it this way:
00058    umtx_init( &aMutex ); */
00059 U_CAPI void U_EXPORT2 umtx_init   ( UMTX* mutex );
00060 
00061 #endif /*_CMUTEX*/
00062 /*eof*/
00063 
00064 
00065 

Generated at Tue Dec 5 17:55:35 2000 for ICU by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000