home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: amiga.prog,comp.sys.amiga.programmer
- Path: sparky!uunet!stanford.edu!ames!elroy.jpl.nasa.gov!jato!jdickson
- From: jdickson@jato.jpl.nasa.gov (Jeff Dickson)
- Subject: Re: Signal Semaphores
- Message-ID: <1992Jul23.155641.7933@jato.jpl.nasa.gov>
- Organization: Jet Propulsion Laboratory
- References: <rwm.711692783@atronx.OCUnix.On.Ca>
- Date: Thu, 23 Jul 1992 15:56:41 GMT
- Lines: 38
-
- In article <rwm.711692783@atronx.OCUnix.On.Ca> rwm@atronx.OCUnix.On.Ca (Russell McOrmond) writes:
- >
- > I'm wondering if anyone has done extensive work with SignalSemaphores under
- >2.04 (V37) that could let me know what I'm doing wrong with my use of them.
- >I just put a 'Forbid()/Permit()' pair around all the things
- >that 'should' have been protected by an ObtainSemaphore/ReleaseSemaphore
- >pair in some multi-threaded code, and a large number of bugs just 'went away'.
- >Since I'd rather that ALL tasks didn't wait, and only those wanting access
- >to these structures, I'd rather get things working.
- >
- > The program in question runs many different processes, all of which share
- >the same global variables. When accessing any of the structures, I had put
- >semaphore arbitration around the calls. Here's some 'example' code from what
- >I'm doing:
-
- I've done extensive work with the signal semaphore stuff, but from Assembly.
- You didn't say what C compiler you're using. If an older MANX (i.e. <= 3.6)
- then the statement:
-
- > if((myconfig=AllocMem(sizeof(config),MEMF_CLEAR))) {
-
- would be wrong if sizeof(config) returns a 16 bit integer instead of a 32 bit
- which AllocMem expects.
-
- >
- >typedef struct config_struct {
- > struct slave_struct mainSlave;
- > /* Slaves */
- > struct SignalSemaphore listLock;
- >
-
- And what are you doing here? Redefining what the keyword struct means?
-
- Investigate those items. Next time post how you declare "config".
-
- jeff
-
-
-