Passing parameters to signal()?

Leslie Mikesell les at chinet.chi.il.us
Thu Sep 20 00:42:08 AEST 1990


In article <122 at wookie.dbaccess.com> ivan at dbaccess.com (Ivan Covdy) writes:

>My limitation is that I cannot have external/global variables for
>functions Action() and WaitSignal(), because these functions can be
>linked to several mains() by different ways on different systems
>(...well, common code can be called from multiple tasks).

As long as you don't allow recursion (and if WaitSignal() actually
waits you obviously don't), all you have to do is declare a static
variable outside of the functions to hold your pointer and copy
the parameter passed to WaitSignal() there.  As long as the Action()
function resides in the same source file, it will be able to access
the static variable, but the name will not be visible elsewhere.
You may have other problems with this code, though, like signals
arriving before you are ready unless WaitSignal() also notifies the
other process(es) when it is prepared to receive them.

Les Mikesell
  les at chinet.chi.il.us



More information about the Comp.unix.questions mailing list