Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Jan 1999 20:15:12 -0500 (EST)
From:      Spike Gronim <spork@ix.netcom.com>
To:        "Mehta, Hiren" <Hiren.Mehta@VLSI.com>
Cc:        "'freebsd-questions@FreeBSD.ORG'" <freebsd-questions@FreeBSD.ORG>
Subject:   Re: reentrant code
Message-ID:  <Pine.BSF.4.05.9901132000290.356-100000@nyc-ny66-33.ix.netcom.com>
In-Reply-To: <B7296B02BA8ED111A610006008A33549019626E6@sjc-magnesium>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 13 Jan 1999, Mehta, Hiren wrote:

> Hi,
> 
> This question is not specific to Freebsd. It is a very general question.
> 
> What is the meaning of reentrant function ? What do I do to make a
> function reentrant ?

A reentrant function is a function that can safely be called by a piece of
code while a process has been temporarily halted in the middle of being
executed. This occurs when signal handlers that return are used. A
function is reentrant when there is no code within it that would
cause conflicts if that code was in the process of being
executed when the program's normal execution was paused (like it would be
if a signal handler was called) and the function was called again from
within whatever function was being executed in the time between the
interruption of normal program execution and the continuation of the
execution of the program. 

According to _Advanced Programming in the Unix Environment_, a reentrant
function must not call malloc(), free(), a function from the standard I/O
library, or a function which uses a static data structure of which there
is only one available to the process. 

Refer to chapter 10, section 6, "Reentrant Functions" of _Advanced
Programming in the Unix Environment_ by W. Richard Stevens for more
information and a list of fucntions known to be reentrant.

That explanation is fairly verbose and unclear, but as exact as I could
make it. Hope it will do. 

> 
> Thanks in advance
> -hiren
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message
> 
> 


	-Spike Gronim
	 sporkl@ix.netcom.com	


		The majority only rules those who let them. 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.05.9901132000290.356-100000>