[EMAIL PROTECTED] wrote: > >Hello together:: > >I have programmed this fuction: > >def OnNewMovie(self, event): > """ Local user receives a new movie event from a user""" > > #self.log.debug( "Got OnNewMovie, " + `event`) > if event.data[0] == self.pubId: > fDep.write("New movie equal\n") > fDep.flush() > #self.log.debug( "Returning, it's my movie") > # This lets two users connect at the same time > self.lockInitSession.acquire() > if self.vInitSession == False: > self.vInitSession = True > self.lockInitSession.release() > else: > self.lockInitSession.release() > return > > #self.log.debug( "Doing remote load event id = " + `event.data[0]` + ", >myid=" + `self.pubId`) > self.lockInitSession.acquire() > self.vInitSession = False > self.lockInitSession.release() > > self.sharedAppClient.UpdateDataCache() > self.GetState() > wx.CallAfter(self.sm.RemoteLoadMovie) > >This function is a handler that is executed when a event occurs. At the end is >wx.CallAfter call. >Imagine that two events occur simultaneously.
Two events cannot occur simultaneously. It is impossible. There is only one message queue for your window. All messages will funnel through that one queue. There is one message loop for the thread that owns the window, which is pulling messages from the queue and dispatching them to message handlers. It cannot pull another message from the queue until you have finished processing this one and returned to the message loop. >This function takes one event. >After executing ax.CallAfter call would tke the second event. Then , my doubt >would be, would be there 2 threads simultanously executing: one belongs to >self.sm.RemoteLoadMovie and the another one belongs to the handler for the >second event? No. wxCallAfter basically posts another message to the message queue, which will be handled after all the existing messages have been dispatched. Windows message handling is quite synchronous. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list