<div dir="ltr">Hello;<div><br></div><div><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15.5555562973022px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:21.6666679382324px">When i run reactor from thread in a synchrone python program, the twisted code is never called.</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15.5555562973022px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:21.6666679382324px">To resolve this problem, I had to put a sleep.</p><pre style="margin-top:0px;padding:5px;border:0px;font-size:13px;overflow:auto;width:auto;max-height:600px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;word-wrap:normal;background-color:rgb(238,238,238)"><code style="margin:0px;padding:0px;border:0px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;white-space:inherit">def _reactor_thread(self):
    if not self.reactor.running:
        self.reactor.run(installSignalHandlers=0)


def _start_thread( self ):

    self.client_thread = Thread( target=self._reactor_thread,
                                 name="mine" )
    self.client_thread.setDaemon(True)
    self.client_thread.start()
    from time import sleep
    sleep( 0.5 )
</code></pre><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15.5555562973022px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:21.6666679382324px">What is the best way to do it, instead of calling sleep?</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15.5555562973022px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:21.6666679382324px"><br></p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15.5555562973022px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:21.6666679382324px">Thank you.</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15.5555562973022px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:21.6666679382324px"><br></p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15.5555562973022px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:21.6666679382324px">Abdel Halim</p>
</div></div>