MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Reentrant Functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg29450] Re: Reentrant Functions
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Wed, 20 Jun 2001 04:36:29 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <9gn6oo$eof$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

a) functions must reentrant in a multi-thread application
   with more than one program thread. A C-function with
   some static local data is not, a C-function that access
   some global data is not. Mathematica has not support 
   for threads (it has MathLink). So you can't make reentrant
   functions  because you can only access a single thread.
   The reentrance problem arises when the same function is 
   called from two different program
   threads at the same time (this is not recursive) and
   this cause trouble with the access of the static data.
   The same applys to functions that access a certain hardware
   port directly.

b) if you mean *recursive* functions, yes Mathematica's function
   can be recursive. However recursion has nothing to do
   with reentrance, because a recursive function can be non-reentrant
   (a factorial that save the first 30 computed values in a static 
    table)
c) you should found out *what* you mean.
d) the manual has a complete description of recursive
   programing -- why not read this book ? 

Regards
  Jens
   

Hermann Schmitt wrote:
> 
> Hello,
> can functions be made reentrant, i.e. can I invoke in a function the
> same function again?
> Hermann Schmitt


  • Prev by Date: RE: Simple question
  • Next by Date: Computational Finance Position
  • Previous by thread: Re: Reentrant Functions
  • Next by thread: Re: Re: Reentrant Functions