home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: SysTools / SysTools.zip / ft-beta.zip / freetype / lib / ttmutex.h < prev    next >
C/C++ Source or Header  |  1997-10-06  |  2KB  |  62 lines

  1. /*******************************************************************
  2.  *
  3.  *  ttmutex.h                                                1.0
  4.  *
  5.  *    Mutual exclusion object / dummy generic interface.            
  6.  *
  7.  *  Copyright 1996, 1997 by
  8.  *  David Turner, Robert Wilhelm, and Werner Lemberg.
  9.  *
  10.  *  This file is part of the FreeType project, and may only be used
  11.  *  modified and distributed under the terms of the FreeType project
  12.  *  license, LICENSE.TXT. By continuing to use, modify or distribute 
  13.  *  this file you indicate that you have read the license and
  14.  *  understand and accept it fully.
  15.  *
  16.  *  Note : This file is a generic interface. The implementation
  17.  *         to compile depends on your system and the type of
  18.  *         library you want to build ( either singly-threaded,
  19.  *         thread-safe or re-entrant ).
  20.  *
  21.  *         Please read the technical documentation for more details
  22.  *
  23.  ******************************************************************/
  24.  
  25. #ifndef TTMUTEX_H
  26. #define TTMUTEX_H
  27.  
  28.   typedef  void*  TMutex;  /* typeless reference to a mutex */
  29.  
  30. #ifdef TT_CONFIG_THREADS  /* for thread-safe and re-entrant builds */
  31.  
  32.   #define MUTEX_Create(mutex)   TT_Mutex_Create ( &(mutex) )
  33.   #define MUTEX_Destroy(mutex)  TT_Mutex_Destroy( &(mutex) )
  34.   #define MUTEX_Lock(mutex)     TT_Mutex_Lock   ( &(mutex) )
  35.   #define MUTEX_Release(mutex)  TT_Mutex_Release( &(mutex) )
  36.  
  37.   void  TT_Mutex_Create ( TMutex*  mutex );
  38.   /* Create a new mutex */
  39.  
  40.   void  TT_Mutex_Delete ( TMutex*  mutex );
  41.   /* Delete a mutex */
  42.  
  43.   void  TT_Mutex_Lock   ( TMutex*  mutex );
  44.   /* Lock a mutex. */
  45.  
  46.   void  TT_Mutex_Release( TMutex*  mutex );
  47.   /* Release a mutex */
  48.  
  49. #else  /* for the single-thread build */
  50.  
  51.   #define MUTEX_Create(mutex)     while(0){}
  52.   #define MUTEX_Destroy(mutex)    while(0){}
  53.   #define MUTEX_Lock(mutex)       while(0){}
  54.   #define MUTEX_Release(mutex)    while(0){}
  55.  
  56.   /* No code will be generated for mutex operations */
  57.  
  58. #endif /* TT_CONFIG_THREADS */
  59.  
  60. #endif /* TTMUTEX_H */
  61.  
  62.