home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_08_08 / 8n08045a < prev    next >
Text File  |  1990-07-18  |  556b  |  36 lines

  1.  
  2.  
  3. func(int type)
  4. {
  5. /* Begin critical section   */
  6. lock();
  7. switch(type)
  8.   {
  9.   case 1:
  10.   /*** Do work for type code 1 ***/
  11.   /*** End critical section    ***/
  12.   unlock();
  13.   return(SUCCESS);
  14.  
  15.   case 2:
  16.   /*** Do work for type code 2 ***/
  17.   /*** End critical section    ***/
  18.   unlock();
  19.   return(SUCCESS);
  20.  
  21.   default:
  22.   if(type > 5) 
  23.     {
  24.     /*** End critical section ***/
  25.     unlock();
  26.     return(ERROR);
  27.     }
  28.   /*** Do default work         ***/
  29.   /*** End critical section    ***/
  30.   unlock();
  31.   return(SUCCESS);
  32.   }
  33. }
  34.  
  35.  
  36.