• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python thread.exit_thread函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中thread.exit_thread函数的典型用法代码示例。如果您正苦于以下问题:Python exit_thread函数的具体用法?Python exit_thread怎么用?Python exit_thread使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了exit_thread函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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()
开发者ID:GeorgeValentin,项目名称:pylen,代码行数:7,代码来源:ThreadTest00.py


示例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;
开发者ID:hcqmaker,项目名称:pytool,代码行数:7,代码来源:server_help.py


示例3: ser_recv

def ser_recv(connfd, cliaddr):
	while True:
		buf = connfd.recv(4096)
		print buf


	thread.exit_thread() 
开发者ID:yywf,项目名称:python,代码行数:7,代码来源:simple_ser.py


示例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)
开发者ID:zhangjianleaves,项目名称:Dahe,代码行数:26,代码来源:JMeterRunner.py


示例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;
开发者ID:hcqmaker,项目名称:pytool,代码行数:7,代码来源:server_help.py


示例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
开发者ID:weiguobin,项目名称:weixin-app,代码行数:29,代码来源:lyric.py


示例7: DataHandle

def DataHandle(mainframe, frame):
    from Command import DataHandleCmd

    _cmd = DataHandleCmd.DataHandleCmd(mainframe, *mainframe.getSamplingParams())
    _cmd.Excute()
    frame.Destroy()
    thread.exit_thread()
开发者ID:qinyushuang,项目名称:ContentThreadPool,代码行数:7,代码来源:DataHandleProcessDialog.py


示例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()
开发者ID:absurdliyang,项目名称:pyhackulits,代码行数:25,代码来源:main.py


示例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()
开发者ID:sedrubal,项目名称:MPRISweb,代码行数:7,代码来源:mpriswrapper.py


示例10: thr_callback

def thr_callback(name,age):
    global thisexit
    print 'name is ', name, ' age is ', age
    
    thisexit = True
    thread.exit_thread()
    return
开发者ID:phpxin,项目名称:pytools,代码行数:7,代码来源:threaddemo.py


示例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()
开发者ID:phimpme,项目名称:generator,代码行数:25,代码来源:models.py


示例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()
开发者ID:fc500110,项目名称:iamrobot,代码行数:7,代码来源:progress.py


示例13: DetectThread

def DetectThread(args):
    urll = args[0]
    callbackFunc = args[1]
    urlstream = urllib.urlopen(urll)
    udata = urlstream.read()
    callbackFunc(udata)
    thread.exit_thread()
开发者ID:raytone813,项目名称:py_tdx,代码行数:7,代码来源:watterson_detector.py


示例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
开发者ID:janenie,项目名称:InstantTalk,代码行数:30,代码来源:server.py


示例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()
开发者ID:vvngmn,项目名称:gittest,代码行数:7,代码来源:threadtest.py


示例16: runner

def runner(arg):
    for i in range(6):
        print str(i)+':'+arg

        time.sleep(1)
    #......
    thread.exit_thread()  #...thread.exit()
开发者ID:huashuolee,项目名称:intel_script,代码行数:7,代码来源:th.py


示例17: updataCj

 def updataCj(self):
     try:
         t=urllib2.urlopen('http://trade.taobao.com/trade/itemlist/list_bought_items.htm')
     except:
         pass
     t.close()
     thread.exit_thread()
开发者ID:lujinda,项目名称:pylot,代码行数:7,代码来源:tbgui.py


示例18: worker

def worker(bot, uid, text, interval):
    cnt = 0
    while cnt<1:
        print 'Thread:(%d) Time:%s\n'%(uid, time.ctime())
        time.sleep(interval)
        cnt+=1
    # res, qus, aut, con = queryTomcat(uid, text)
    res, qus, answers = queryTomcat(uid, text)
    #print 'before process:'+con
    # con = con.replace('<p>','')
    # con = con.replace('</p>','\n')
    # print 'after process:'+con
    #bot.sendMessage(chat_id=uid,text=res)
    #bot.sendMessage(chat_id=uid,text=qus)
    ## bot.sendMessage(chat_id=uid,text=qus.encode('utf-8'))#same result like upper one
    #bot.sendMessage(chat_id=uid,text=aut,parse_mode=ParseMode.HTML)
    #bot.sendMessage(chat_id=uid,text=con,parse_mode=ParseMode.HTML)
    ## bot.sendMessage(chat_id=uid,text=aut.decode('ISO-8859-1'))#bad using
    ## bot.sendMessage(chat_id=uid,text=aut.encode('utf-8'))#bad using
    ## bot.sendMessage(chat_id=uid,text='<b>'+aut+'</b>',parse_mode=ParseMode.HTML)#bad using
    if len(answers)>0:
        print 'get answers:'
        bot.sendMessage(chat_id=uid, text='已找到答案,请稍后...')
        for ans in answers:
            print ans
            finContent = '问题:'+ans['qus'].encode('utf-8')+'\n----------------------\n答案:'+ans['ans'].encode('utf-8')+'\n\n\n相似性:'+str(ans['sco'])
            print finContent
            bot.sendMessage(chat_id=uid, text=finContent)
    else:
        print 'no answers'
        bot.sendMessage(chat_id=uid, text='没找到答案,换个问题吧~')

    thread.exit_thread()
开发者ID:BigDipper7,项目名称:Telegram-Bot---QA-Bot,代码行数:33,代码来源:main-server.py


示例19: check_bypass

def check_bypass(dump_file):
    """
    Get the file flags of domain core dump file and check it.
    """

    cmd1 = "lsof -w %s >/dev/null 2>&1" % dump_file
    while True:
        if os.path.exists(dump_file):
            if not os.system(cmd1):
                cmd2 = ("cat /proc/$(%s |awk '/libvirt_i/{print $2}')/fdinfo/1"
                        "|grep flags|awk '{print $NF}'" % cmd1)
                (status, output) = commands.getstatusoutput(cmd2)
                if status == 0:
                    if len(output):
                        logging.debug("The flags of dumped file: %s ", output)
                        file_flag = output[-5]
                        if check_flag(file_flag):
                            logging.info("Bypass file system cache "
                                         "successfully when dumping")
                        else:
                            raise error.TestFail("Bypass file system cache "
                                                 "fail when dumping")
                        break
                else:
                    logging.error("Fail to get the flags of dumped file")
                    return 1

    thread.exit_thread()
开发者ID:QiuMike,项目名称:virt-test,代码行数:28,代码来源:virsh_dump.py


示例20: __block__execute__

 def __block__execute__(self,sql):
     with self.connection.cursor(pymysql.cursors.DictCursor) as cursor:
         cursor.execute(sql)
         try:
             self.connection.commit()
         finally:
             thread.exit_thread()
开发者ID:LMCW,项目名称:SuriWeb,代码行数:7,代码来源:database.py



注:本文中的thread.exit_thread函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python thread.get_ident函数代码示例发布时间:2022-05-27
下一篇:
Python thread.exit函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap