<font class="fixed_width" face="Courier, Monospaced">Hi , <br> </font><p><font class="fixed_width" face="Courier, Monospaced"> I am having a problem
while using sleep function from libc , the <br> thread in which i am
calling it is getting struck and not allowing <br> other threads to
execute. Here is a simple code that i am trying to <br> exeute <br> </font></p><p><font class="fixed_width" face="Courier, Monospaced">import threading <br>
import time <br> import dl <br> </font></p><p><font class="fixed_width" face="Courier, Monospaced">def dummy1(): <br>
a=dl.open('/lib/libc.so.6') <br> print "in thread 1 Start" <br>
a.call('sleep',2) <br> #time.sleep(2) <br> print "in thread 1
End" <br> </font></p><p><font class="fixed_width" face="Courier,
Monospaced">def dummy2(): <br> print "in thread 2 Start" <br>
time.sleep(1) <br> print "in thread 2 End" <br>
newThread1=threading.Thread(None,dummy1) <br>
newThread2=threading.Thread(None,dummy2) <br> newThread1.start() <br>
newThread2.start() <br> </font></p><p><font class="fixed_width" face="Courier, Monospaced">print "in main" <br> </font></p><p><font class="fixed_width" face="Courier, Monospaced">The out put of this
program is (In this case thread 1 even though i <br> am calling a sleep
function its not allowing other threads to execute, <br> other threads
execute only after the completion of first thread) <br> </font></p><p><font class="fixed_width" face="Courier, Monospaced">in thread 1 Start <br>
in thread 1 End <br> in thread 2 Start <br> in main <br> in thread 2 End
<br> </font></p><font class="fixed_width" face="Courier, Monospaced">where
as if i use time.sleep instead of a.call(sleep) the out put is <br>
(which i guess is right behaviour, because it start the threads and <br>
suspends them because the have sleep , and continue executing the main <br>
thread) <br> in thread 1 Start <br> in thread 2 Start <br> in main <br>
in thread 2 End <br> in thread 1 End<br><br><br>Can any of you point me how to over come this.? <br>Thanks<br>Mahesh<br></font>