当前位置: 首页>>代码示例>>Python>>正文


Python thread.exit_thread函数代码示例

本文整理汇总了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()
开发者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


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