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