home *** CD-ROM | disk | FTP | other *** search
/ BUG 15 / BUGCD1998_06.ISO / aplic / jbuilder / jruntime.z / mutex_md.h < prev    next >
C/C++ Source or Header  |  1997-08-25  |  2KB  |  48 lines

  1. /*
  2.  * @(#)mutex_md.h    1.9 96/11/23
  3.  * 
  4.  * Copyright (c) 1995, 1996 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  * CopyrightVersion 1.1_beta
  20.  * 
  21.  */
  22.  
  23. /*
  24.  * Win32 implementation of mutexes. Here we use critical sections as
  25.  * our mutexes. We could have used mutexes, but mutexes are heavier
  26.  * weight than critical sections. Mutexes and critical sections are
  27.  * semantically identical, the only difference being that mutexes
  28.  * can operate between processes (i.e. address spaces).
  29.  *
  30.  * It's worth noting that the Win32 functions supporting critical
  31.  * sections do not provide any error information whatsoever (i.e.
  32.  * all critical section routines return (void)).
  33.  */
  34.  
  35. #ifndef    _WIN32_MUTEX_MD_H_
  36. #define    _WIN32_MUTEX_MD_H_
  37.  
  38. #include <windows.h>
  39.  
  40. typedef CRITICAL_SECTION mutex_t;
  41.  
  42. #define mutexInit(m)    InitializeCriticalSection(m)
  43. #define mutexDestroy(m)    DeleteCriticalSection(m)
  44. #define mutexLock(m)    EnterCriticalSection(m)
  45. #define mutexUnlock(m)    LeaveCriticalSection(m)
  46.  
  47. #endif    /* !_WIN32_MUTEX_MD_H_ */
  48.