On 6/27/06, <b class="gmail_sendername">Kent Johnson</b> <<a href="mailto:kent37@tds.net">kent37@tds.net</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Tino Dai wrote:<br>> How I have it now:<br>><br>> semaA = threading.semaphore()<br>><br>> class nameA:<br>> def __init__(self):<br>> <do some stuff><br>><br>> def run(self):
<br>> <do some stuff><br>> semaA.release()<br>><br>> class nameB:<br>> def __init__(self):<br>> <do some stuff><br>><br>> def run(self):
<br>> semaA.acquire()<br>> <do some stuff><br>><br>><br>> Does that make sense. Or is there a better way?<br><br>class nameA:<br> def __init__(self, sema):<br> self.sema
= sema<br> <do some stuff><br><br> def run(self):<br> <do some stuff><br> self.sema.release()<br><br>class nameB:<br> def __init__(self, sema):<br> self.sema = sema<br> <do some stuff>
<br><br> def run(self):<br> self.semaA.acquire()<br> <do some stuff><br><br><br>In the client code or the unit test:<br>semaA = threading.semaphore()<br>anA = nameA(semaA)<br>aB = nameB(semaA)<br>anA.run
()<br>aB.run()</blockquote><div><br>I got it. I guess it doesn't work like regular variables! Thanks! -Tino<br></div><br></div>