Threading blocking functions

Roy Katz katz at Glue.umd.edu
Sun Aug 20 19:23:12 EDT 2000


Hi!


If a function is called simulatenously by different threads,
will each thread blocand wait for the function to finish executing,
or will a new copy of the function begin executing? How can I specify
either behaviour (blocking, nonblocking)?

I wrote a piece of code with the following behaviour:

# only one copy of this function must run at one time.
def update( data ):
   do-something-with-data

# many of these are run, and they all call update(). 
def thread():
   # I want this to block until update() is no longer busy
   # servicing other threads.
   data = something
   update( data )



Thanks,
Roey Katz




More information about the Python-list mailing list