我有一個例子執行功能誰應該表現出我想要做的在隊列
queue = 2
def function():
print 'abcd'
time.sleep(3)
def exec_times(times):
#do something
function()
def exec_queue(queue):
#do something
function()
exec_times(3)
#things need be working while it waiting for the function finish
time.sleep(10)
什麼結果應該是
abcd
abcd
#after finish the first two function executions
abcd
如此,還有一個辦法做到這一點不使用trhead?
我的意思是一些glib函數來完成這項工作。
您需要有某種線程/多進程模型才能併發執行。 – 2010-07-18 17:55:56