home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / os / bsdss4.tz / bsdss4 / bsdss / server / sys / parallel.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-22  |  1.6 KB  |  60 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1992 Carnegie Mellon University
  4.  * All Rights Reserved.
  5.  * 
  6.  * Permission to use, copy, modify and distribute this software and its
  7.  * documentation is hereby granted, provided that both the copyright
  8.  * notice and this permission notice appear in all copies of the
  9.  * software, derivative works or modified versions, and any portions
  10.  * thereof, and that both notices appear in supporting documentation.
  11.  * 
  12.  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  13.  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  14.  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  15.  * 
  16.  * Carnegie Mellon requests users of this software to return to
  17.  * 
  18.  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
  19.  *  School of Computer Science
  20.  *  Carnegie Mellon University
  21.  *  Pittsburgh PA 15213-3890
  22.  * 
  23.  * any improvements or extensions that they make and grant Carnegie Mellon 
  24.  * the rights to redistribute these changes.
  25.  */
  26. /*
  27.  * HISTORY
  28.  * $Log:    parallel.h,v $
  29.  * Revision 2.1  92/04/21  17:16:36  rwd
  30.  * BSDSS
  31.  * 
  32.  *
  33.  */
  34.  
  35. /*
  36.  * Serialization for threads within the kernel.
  37.  */
  38.  
  39. extern struct mutex master_mutex;
  40.  
  41. #define master_lock() mutex_lock(&master_mutex)
  42.  
  43. #define master_unlock() mutex_unlock(&master_mutex)
  44.  
  45. #define    unix_master()    {            \
  46.     if (p->p_master_lock++ == 0)        \
  47.         master_lock();            \
  48. }
  49.  
  50. #define    unix_release()    {            \
  51.     if (--p->p_master_lock == 0)        \
  52.         master_unlock();            \
  53. }
  54.  
  55. #define    unix_reset()    {            \
  56.     if (p->p_master_lock > 0)        \
  57.         p->p_master_lock = 1;        \
  58. }
  59.  
  60.