Re: MainThread blocks all others

2005-08-16 Thread Nodir Gulyamov
Thank you very much to all. I found out solution. I created separate thread from GUI and everything is working correct. Best Regards, /Gelios -- http://mail.python.org/mailman/listinfo/python-list

Re: MainThread blocks all others

2005-08-11 Thread Bryan Olson
Nodir Gulyamov wrote: > [...]I should show you real code [...] > Please find below real code. Sorry for amount of sources. Yeah, it's too much for me. Can you construct a minimal example that doesn't do what you think it should? -- --Bryan -- http://mail.python.org/mailman/listinfo/python-li

Re: MainThread blocks all others

2005-08-11 Thread Nodir Gulyamov
Dennis, I am really appreciated you comments. Thanks you very much. And let me a little bit explain idea of program. I should did it earlier. Instead of empty loops i already tried to use time.sleep() firstly, but effect was same, all other threads do not working too and as experiment i tried

Re: MainThread blocks all others

2005-08-10 Thread Nodir Gulyamov
Hello Dennis and Bryan! You were absolutely right. I should show you real code instead of brain fucking. I am very sorry. Please find below real code. Sorry for amount of sources. Main aspect of program is all process should be in one determined sequence containing 3 stages. They are defined

Re: MainThread blocks all others

2005-08-10 Thread Bryan Olson
Nodir Gulyamov wrote: > Hi again, comments below: > > >>>doSomeJob(self): >>># BLOCKING HERE ### >>>if not self.myEvent.isSet(): >>>self.myEvent.wait() >> >>The initial 'if' is superflous. > > Excuse me, please explain. The code: if some_event.i

Re: MainThread blocks all others

2005-08-10 Thread Nodir Gulyamov
Hi again, comments below: > > doSomeJob(self): > > # BLOCKING HERE ### > > if not self.myEvent.isSet(): > > self.myEvent.wait() > > The initial 'if' is superflous. Excuse me, please explain. > > self.myEvent.clear() > > # ... continue... > > >

Re: MainThread blocks all others

2005-08-10 Thread Nodir Gulyamov
Hi, Thanks your reply again. Please find my comments below. > Your code did not, and could not, use the value of counter for > anything but busy-waiting. You had: > > while counter != 1: > pass > # ... continue... > > If you replace this with the semaphore, you can

Re: MainThread blocks all others

2005-08-10 Thread Bryan Olson
Nodir Gulyamov wrote: > Tried to rewrite using Event() just as experiment, but unfortunately > MainThread will blocking all others. > Code below: > > import threading > > class class1: > def __init__(self): > self.myEvent = threading.Event() > result = doSomeJob() >

Re: MainThread blocks all others

2005-08-10 Thread Bryan Olson
Nodir Gulyamov wrote: > Hi Bryan, > Thanks for your reply. > I tried to test your solution, but it doesn't work, hence > threading.Semaphore object hasn't method to get value of semaphore. > I looked to source code of semaphore.py and find out that value is private > variable. Your code

Re: MainThread blocks all others

2005-08-10 Thread Nodir Gulyamov
Tried to rewrite using Event() just as experiment, but unfortunately MainThread will blocking all others. Code below: import threading class class1: def __init__(self): self.myEvent = threading.Event() result = doSomeJob() def increaseCounter(self): self.myEvent.

Re: MainThread blocks all others

2005-08-10 Thread Nodir Gulyamov
I had future investigation and as I understand in POSIX compliant threads, getting value of semaphore should be exist. As the matter of fact Python threads is not fully POSIX compliant. Pitty! Contining looking for another solution. "Nodir Gulyamov" <[EMAIL PROTECTED]> wrote in message news:[EMA

Re: MainThread blocks all others

2005-08-10 Thread Nodir Gulyamov
Hi Bryan, Thanks for your reply. I tried to test your solution, but it doesn't work, hence threading.Semaphore object hasn't method to get value of semaphore. I looked to source code of semaphore.py and find out that value is private variable. Best regards, /Gelios "Bryan Olson" <[EMAIL PRO

Re: MainThread blocks all others

2005-08-09 Thread Bryan Olson
I wrote: > Make self.counter a semaphore. Untested code: A little clean-up. Still untested: import threading class class1: def __init__(self): self.counter = threading.semaphore(0) result = self.doSomeJob() def increaseCounter(self): self.counter.release()

Re: MainThread blocks all others

2005-08-09 Thread Bryan Olson
Nodir Gulyamov wrote: > Hello All! > I met some strange situation. In MainThread my program wating changes of > some variable. This variable should be changed in another thread, but loop, > which wait changing variable blocks all other threads. > Code below: > > class class1: > def __ini

MainThread blocks all others

2005-08-09 Thread Nodir Gulyamov
Hello All! I met some strange situation. In MainThread my program wating changes of some variable. This variable should be changed in another thread, but loop, which wait changing variable blocks all other threads. Code below: class class1: def __init__(self): self.counter = 0