Pumpkin, Inc.

Pumpkin User Forums

Semaphores and BinSemaphores

If you can't make Salvo do what you want it to do, post it here.

Semaphores and BinSemaphores

Postby luben » Sat Jan 27, 2001 9:56 am


If I use only bin semaphores does SALVO take memory for counting semaphores. What is the option to disable counting semaphores.
There is an option to enable BinSemaphores, what is the option to disable Counting Semaphores.


Posts: 324
Joined: Sun Nov 19, 2000 12:00 am
Location: Sofia, Bulgaria

Re: Semaphores and BinSemaphores

Postby aek » Sat Jan 27, 2001 10:29 am

The code (ROM) for binary semaphores (binSems) and counting semaphores (sems) is contained in separate modules (binsem.c vs. sem.c) and services (OSCreateBinSem() vs. OSCreateSem(), etc.). There is some common code that is common to all event services in event.c.

The memory (RAM) for binSems and sems is the same, as long as OSBIG_SEMAPHORES is FALSE (the default). All of Salvo's event control blocks (ecbs) are the same size, and the number of ecbs is set by OSEVENTS. Some events (message queues, binKeys) have their own, extra control blocks that consume additional RAM.

If you are using the freeware libraries and only binSems, Salvo won't take any memory for counting semaphores.

If you have the full version, and you have compiled both binsem.c and sem.c as nodes in your project, then your hex file will contain both the binSem and the sem code. To avoid this, set OSENABLE_SEMAPHORES to FALSE and re-make the project. This disables the counting-semaphore-specific code. These configuration options have no effect on the freeware libraries.

Note also that you can use messages in place on binary semaphores -- the User Manual has more details on this. Thus, if you had an application that used messages, binSems as flags and binSems as resources, you could minimize the Salvo code size by using only messages.

Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Return to Coding

Who is online

Users browsing this forum: No registered users and 1 guest