MainThread blocks all others

Nodir Gulyamov gelios at rbcmail.ru
Thu Aug 11 05:05:43 EDT 2005


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 empty loops then. All stages as numbered should be accomplished 
sequently and no thread needed there. The reason of waiting in the begining 
of each stage is waiting insertion of Sim cards to reader. When card 
inserted CardMonitor which implements observer calls update() method of each 
subscriber. In my case this is CardsObserver.update() method. This is 
accomplished in seperate thread created in CardMonitor library class (by the 
way I just only write main application, all other sources are from 
framework). As you can see CardsObserver.update () calls 
appMainFrame.addCards method which update step semaphore. I did realize it 
by using semaphore based on Bryan solution. Firstly it was just only integer 
variable and addCards() increment it by 1.
In any case I cannot understand why when MainThread is doing some action, 
even sleeping (time.sleep()) all other threads blocked as well.
Regarding to other your comments. Honestly this is my first experience in 
Python and as I suppose I didn't understand main principles and ideas of 
Python up to now. Well, this is a way for future investigation. :)

Best regards,
/Gelios 





More information about the Python-list mailing list