Re: basic threading question



chris.monsanto@xxxxxxxxx wrote:
On Oct 30, 7:58 pm, "bambam" <da...@xxxxxxxxx> wrote:
Are function variables thread safe?

def f(a):
# whatever
return float(a)

Is that OK?

def f(a):
#whatever
b=a:
#whatever:
return float(b)

Is that OK?

Steve.

Huh?

If I have 37 threads, all calling a large function 'f', are the formal parameters thread safe?

That is, will the formal parameters be trashed? Do you need to use locks or semaphores before using formal parameters? Are the labels for
formal parameters static?

If I have 73 threads, all calling a large function 'f', are the local values thread safe? Does each thread maintain it's own stack? Are the labels for local values stack-based?

Steve.

.



Relevant Pages

  • Re: basic threading question
    ... Do you need to use locks or semaphores before using formal parameters? ... If I have 73 threads, all calling a large function 'f', are the local values thread safe? ... Are the labels for local values stack-based? ...
    (comp.lang.python)
  • Re: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code
    ... >I think this is a bad idea, for a subtle reason. ... >In Python, unlike many other languages, the names of formal parameters are ... > def f: ... >the interface of every method that uses the feature. ...
    (comp.lang.python)
  • Re: tool to check whether formal and actual parameters have similar names
    ... > checking of actual and formal parameters to warn about likely errors. ... > def plot: ... ... GUIWindows.insert_member(child, parent) ... EncryptionAlgorithms.insert_member(parent, child) ...
    (comp.lang.python)