From owner-freebsd-questions Wed Jan 13 17:18:03 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id RAA04227 for freebsd-questions-outgoing; Wed, 13 Jan 1999 17:18:03 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from nyc-ny70-38.ix.netcom.com (nyc-ny70-38.ix.netcom.com [209.109.226.166]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id RAA04207 for ; Wed, 13 Jan 1999 17:17:59 -0800 (PST) (envelope-from spork@nyc-ny70-38.ix.netcom.com) Received: from spork (helo=localhost) by nyc-ny70-38.ix.netcom.com with local-esmtp (Exim 2.05 #1) id 100bNR-0000ZQ-00; Wed, 13 Jan 1999 20:15:13 -0500 Date: Wed, 13 Jan 1999 20:15:12 -0500 (EST) From: Spike Gronim Reply-To: sporkl@ix.netcom.com To: "Mehta, Hiren" cc: "'freebsd-questions@FreeBSD.ORG'" Subject: Re: reentrant code In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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