[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: [LI] How pass parameters to function through alarm ......



On Thu, Jan 13, 2000 at 12:52:53PM +0530, Arun K Desai wrote:
> Hi all,
> 
> I am working on Redhat Linux 6.0 & C.
> 
> I am using alarm system call..
> 
>   signal(SIGALRM,fun);/* fun is function 
>                               adrress*/
> My prblem is how to pass a value(int parameter) to function(fun) which set in signal alarm?????

You can't pass the value. The value is automatically constructed by the
OS. In particular, it will always be the signal number - in your case,
SIGALRM = 14.

I think the idea is, same handler could be used for different signals
and the handler has no way of finding out which signal caused the call,
in the absence of this parameter.

Note that signals are asynchronous routines. So the idea of "passing"
a parameter doesn't work well, because you don't call the signal handler.
The OS does.

	-Arun

--------------------------------------------------------------------
The Linux India Mailing List Archives are now available.  Please search
the archive at http://lists.linux-india.org/ before posting your question
to avoid repetition and save bandwidth.