本文整理汇总了Python中thread.exit_thread函数的典型用法代码示例。如果您正苦于以下问题:Python exit_thread函数的具体用法?Python exit_thread怎么用?Python exit_thread使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了exit_thread函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: timer
def timer(no, interval):
counter = 0
while counter < 10:
print "Thread :(%d), time:%s" % (no, time.ctime())
time.sleep(interval)
counter += 1
thread.exit_thread()
示例2: handle_unzip
def handle_unzip(filename, path, obj):
cmd_str = "unzip -d " + path + " " + filename;
print(cmd_str);
ss = os.popen(cmd_str).read();
obj.end_unzip(ss);
thread.exit_thread();
return;
示例3: ser_recv
def ser_recv(connfd, cliaddr):
while True:
buf = connfd.recv(4096)
print buf
thread.exit_thread()
示例4: runJMeterJob
def runJMeterJob(self, job_file):
global flag_running
flag_running = True
jmeter_launcher = self.jmeterhome + "JMeterLauncher.bat"
#[12/04/2015-Yanhong]need switch working directory to self.jmeterhome
#otherwise exception in JMeterLauncher
os.chdir(self.jmeterhome)
cmd = 'call ' + jmeter_launcher + ' JOB "' + job_file +'"'
self.runnerlogger.info(cmd)
time.sleep(12)
javahome = os.getenv("JAVA_HOME")
java='\"'+javahome+"\\bin\\java.exe"+'\"'
print java
os.putenv("JM_LAUNCH", java)
try:
os.system(cmd)
except:
self.runnerlogger("Exception in run job: "+job_file)
flag_running = False
try:
thread.exit_thread()
except Exception, e:
#self.runnerlogger("Exception in exit_thread. The thread may be already killed.")
print "Exception in exit_thread: " + str(e)
示例5: handle_download
def handle_download(url, zip_name, obj):
cmd_str = "wget -O " + zip_name + " " + url;
print(cmd_str);
ss = os.popen(cmd_str).read();
obj.end_download(ss);
thread.exit_thread();
return;
示例6: _downLoad_lyric_thread
def _downLoad_lyric_thread(self, fromUser, toUser, text_content, wc_client):
lyric = None
song = ''
if isinstance(text_content, tuple):
song, artist_name = text_content
lyrics = self.getLyricsBySongnameFromHttp(song, artist_name)
if (len(lyrics) >= 1):
lyric = lyrics[0]
elif isinstance(text_content, Lyric):
lyric = text_content
song = lyric.song
elif isinstance(text_content, unicode) or isinstance(text_content, str):
reply_content = Custon_send_text_data_template % {'touser':fromUser, 'content':text_content}
wc_client.message.custom.send.post(body=reply_content)
thread.exit_thread()
return
if isinstance(song, unicode):
song = song.encode('utf-8')
if lyric:
try:
text_content = self._downLoad_lyricFromHttp(lyric)
except Exception, e:
text_content = '找不到歌曲:%s %s'%(song,artist_name) if artist_name \
else '找不到歌曲:%s'%song
示例7: DataHandle
def DataHandle(mainframe, frame):
from Command import DataHandleCmd
_cmd = DataHandleCmd.DataHandleCmd(mainframe, *mainframe.getSamplingParams())
_cmd.Excute()
frame.Destroy()
thread.exit_thread()
示例8: do
def do(id):
global alive
global finished,succeed
aliveLock.acquire()
alive += 1
aliveLock.release()
conn = httplib.HTTPConnection('tw.heuet.edu.cn:82')
conn.request('HEAD', '/View.asp?id=%i' % id)
res = conn.getresponse()
fLock.acquire()
if res.status == 200:
succeed += 1
else:
lockP.acquire()
print res.status
print res.getheaders()
lockP.release()
finished += 1
alive -= 1
fLock.release()
thread.exit_thread()
示例9: glib_loop_thread
def glib_loop_thread(self):
"""
runs the GLib main loop to get notified about player status changes
"""
self.mloop.run()
log("GLib loop exited", min_verbosity=2)
thread.exit_thread()
示例10: thr_callback
def thr_callback(name,age):
global thisexit
print 'name is ', name, ' age is ', age
thisexit = True
thread.exit_thread()
return
示例11: generate_thread
def generate_thread(id, t):
"""
TODO:FIXME: porting real generate interface
call generate(app_name, app_logo, enables) instead
"""
# time.sleep(t)
o = order.objects.get(id=id)
if o is None:
raise Exceptions('order %s be not found' % (id))
else:
if o.order_is_rebuild == True:
o.order_status = 3
else:
o.order_status = 2
# generator script
web_path = '/static/output_path/' + str(id) + '.apk'
abs_path = os.path.abspath('Phimpme' + web_path)
from gen_script import generate
print o.order_features
generate(order_id=id, output_path=abs_path, app_name=o.order_appname, app_logo=None, enables=eval(o.order_features))
o.order_output_file = web_path
o.save()
thread.exit_thread()
示例12: simpleThdreadFun
def simpleThdreadFun(interval):
global g_nProcessed
global g_nTotal
while g_nTotal > g_nProcessed:
time.sleep(interval)
g_nProcessed += 1
thread.exit_thread()
示例13: DetectThread
def DetectThread(args):
urll = args[0]
callbackFunc = args[1]
urlstream = urllib.urlopen(urll)
udata = urlstream.read()
callbackFunc(udata)
thread.exit_thread()
示例14: sendMessageToAll
def sendMessageToAll(clientsock,client,name): #群聊监听用户发来信息
global cancelSignal
global judge
global messageAll
m = Message()
while True:
eve.clear() # 若已设置标志则清除
eve.wait() # 调用wait方法
if cancelSignal != "":
if name == cancelSignal:
# print "name" , name
time.sleep(0.01)
mutex.acquire()
cancelSignal = ""
mutex.release()
eve.clear()
clientsock.send(m.updateOnlineUsersMsg(name,judge[name]))#judge为判断上下线
if judge[name] == 0:
clientsock.close()
thread.exit_thread()
pass
pass
pass
#if judge[client2[0]] == 1:
else:
print messageAll
clientsock.send(messageAll)
pass
time.sleep(0.05)
pass
示例15: timer
def timer(threadNo,interval):
cnt = 0
while cnt<10:
print 'Thread:%d Time: %s\n'%(threadNo, time.ctime())
time.sleep(interval)
cnt+=1
thread.exit_thread()