home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / admin / 4812 < prev    next >
Encoding:
Text File  |  1992-09-01  |  1.4 KB  |  40 lines

  1. Newsgroups: comp.unix.admin
  2. Path: sparky!uunet!usc!cs.utexas.edu!torn!cunews!nrcnet0!bnrgate!bcrka451!norm
  3. From: norm@bnr.ca (Norm MacNeil)
  4. Subject: Semaphore int value assignment
  5. Message-ID: <1992Sep1.141211.20751@bcrka451.bnr.ca>
  6. Originator: norm@bcrks122
  7. Sender: 5E00 Corkstown News Server
  8. Reply-To: norm@bnr.ca
  9. Organization: Bell-Northern Research Ltd.
  10. Date: Tue, 1 Sep 1992 14:12:11 GMT
  11. Lines: 27
  12.  
  13.  
  14. In the use of semaphores, the union semun is defined as
  15.  
  16. union semun {
  17.   int val;
  18.   struct sem_ds *buf;
  19.   ushort * array;
  20. } arg;
  21.  
  22. So if I only use GETVAL or SETVAL, I am using arg.val; however, I cannot seem
  23. to set arg.val to -1 or 0xFFFF to indicate that the value is not yet set.  I don't
  24. want to use 0 because I will be passing back an int of bit flags and 0 would mean,
  25. of course, that no flags are set but any value where more than the number of flags
  26. used is set means that the semaphore is not yet set.
  27.  
  28. Anyway, if val is an int, why can't I use -1 or 0xFFFF or some other large number?
  29. I don't see any restrictions on the int value in the man of semctl(), etc.
  30.  
  31. Thanks,
  32.   Norm.
  33.  
  34. -- 
  35. +-----------------------------------------------------------------------+
  36.  Norm MacNeil                     Phone: (613) 763-7497
  37.  CAD Operation                      Fax: (613) 763-3317
  38.  Bell-Northern Research Ltd.      EMail: norm@bnr.ca (INTERNET)
  39.  #include <disclaimer.std>       "Roller bladers do it in-line!"
  40.