本文整理汇总了Python中threading._start_new_thread函数的典型用法代码示例。如果您正苦于以下问题:Python _start_new_thread函数的具体用法?Python _start_new_thread怎么用?Python _start_new_thread使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_start_new_thread函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start_thread
def start_thread(self, lock=None):
assert lock or self.lock
if lock: self.lock = lock
if self.ready:
threading._start_new_thread( self.loop, () )
else:
print('Warning: no webcam found')
示例2: __init__
def __init__(self, address, listenerport):
self.listener, self.listenerAddress = None, None
self.listenerBase = socket.socket()
self.listenerBase.bind((address, listenerport))
self.listenerBase.listen(1)
self.sender = socket.socket()
threading._start_new_thread(self.THREAD_connectionscatcher, ())
示例3: main
def main():
print('knock knock')
a = input('')
print('Interrupting cow.')
threading._start_new_thread(interrupt, (3,))
b = input('')
示例4: card_shuffle
def card_shuffle():
global card
random.shuffle(card)
set_filename("card_shuffle")
threading._start_new_thread(play_sound,())
print ("\n카드를 섞는 중입니다...\n")
print ("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n")
示例5: login_danmu_server
def login_danmu_server(self, is_all_danmu = False):
if self.__gid == None:
if not self.login_danmu_auth_server():
print('Login danmu auth server failed')
return False
login_info = self.__douyu_login_client.get_login_info()
self.__recv_danmu_socket.connect(danmu_client.__address_danmu_1)
login_data = '[email protected]=loginreq/[email protected]=' + login_info['acf_username'] + '/[email protected]=1234567890123456/[email protected]=' + self.__room_id
self.__send_msg(login_data, self.__recv_danmu_socket)
recv_data = self.__get_next_data(self.__recv_danmu_socket)
parse_result = self.__parse_recv_msg(recv_data)
if 'type' in parse_result and parse_result['type'] == 'loginres':
if is_all_danmu:
join_group = '[email protected]=joingroup/[email protected]=' + self.__room_id + '/[email protected]=' + '-9999'
else:
join_group = '[email protected]=joingroup/[email protected]=' + self.__room_id + '/[email protected]=' + self.__gid
self.__send_msg(join_group, self.__recv_danmu_socket)
threading._start_new_thread(self.__recv_socket_keep_alive, ())
示例6: jdpay_wap
def jdpay_wap():
env_name, root_url, live_key, app_id = datagen.get_current_env()
url = "{0}/v1/charges".format(root_url)
# request body
charge = Model.ChargeBase.ChargeDict
charge['order_no'] = random_str(10)
charge['subject'] = 'TestOrder4jdpay_wap'
charge['body'] = 'appletest4Pay'
charge['amount'] = 10
charge['channel'] = 'jdpay_wap'
charge['currency'] = 'cny'
charge['client_ip'] = '127.0.0.1'
id = [('id', app_id)]
extra = [("success_url", "http://pingxx.com"), ("fail_url", "htpps://pingxx.com")]
charge['app'] = dict(id)
charge['extra'] = dict(extra)
mycharge = APIClient._http_call(url, "post", "json", "json", None, {"Authorization": "Bearer {0}".format(live_key)},
30, **charge)
print(mycharge)
sshCmd.ssh_cmd("114.215.237.77", "56f27c2B", "echo "">/var/www/example/ziteng")
threading._start_new_thread(sshCmd.ssh_cmd("114.215.237.77", "56f27c2B", "echo "">/var/www/example/ziteng"))
time.sleep(5)
Forward.forward_json(mycharge)
ret = sshCmd.ssh_cmd("114.215.237.77", "56f27c2B", "echo "">/var/www/example/ziteng")
print ret
if int(filter(lambda x: x.isdigit(), ret)) > 1:
print "The charge file had updated on %s" % ctime()
else:
print "forward the charge to update file again..."
threading._start_new_thread(sshCmd.ssh_cmd("114.215.237.77", "56f27c2B", "echo "">/var/www/example/ziteng"))
time.sleep(2)
Forward.forward_json(mycharge)
示例7: start_threads
def start_threads( self, lock ):
if self.kinect.ready:
threading._start_new_thread( self.kinect.loop, (lock,) )
threading._start_new_thread( self.proc_contours.loop, (lock,) )
#threading._start_new_thread( self.proc_shapes.loop, (lock,) )
else:
print( 'Warning: no kinect devices found' )
示例8: __init__
def __init__(self):
self.closed = False
self.objects = {}
self.scale = 3
master = Tk()
master.title("B0rbit - The ultimate DarkOrbit b0t. Beta v0.1")
master.protocol("WM_DELETE_WINDOW", self._winExitHandler)
self.w = Canvas(master, width=200 * self.scale, height=125 * self.scale)
self.w.pack()
self.w.create_rectangle(0, 0, 200 * self.scale, 125 * self.scale, fill="black")
self._lineHeroY = self.w.create_line(0 * self.scale, 55 * self.scale, 200 * self.scale, 55 * self.scale, fill="blue")
self._lineHeroX = self.w.create_line(100 * self.scale, 0 * self.scale, 100 * self.scale, 125 * self.scale, fill="blue")
self._textInfoBox = self.w.create_text(10, 10, anchor=NW, text="Lade...", fill="white")
threading._start_new_thread(mainloop, ())
示例9: run
def run(self):
self._sock.listen(5)
while True:
conn, addr = self._sock.accept()
print("Connected with " + addr[0] + ":" + str(addr[1]))
_start_new_thread(self.diffieHellmanThread, (conn,))
示例10: tell_story
def tell_story(count):
time.sleep(5)
print(story[count])
if not count + 1 == len(story):
threading._start_new_thread(tell_story, (count + 1,))
示例11: start
def start(self):
self.active = True
self.loops = 0
if hasattr(self,'setup'): self.setup()
if threading:
threading._start_new_thread( self.loop, () )
else:
thread.start_new_thread( self.loop, () )
示例12: connect
def connect():
print("connect()")
global s, conn, CONN_Flag
while 1:
conn, addr=s.accept()
CONN_Flag=True
threading._start_new_thread(recv_msg,())
print("connect success :", addr)
示例13: connect
def connect(self, address, listenerport):
# self.connectionsCatcher.terminate()
self.sender.connect((address, listenerport)) # I sender connects to II listener
self.connecting = True
self.sender.send(str(self.listenerBase.getsockname()[1]).encode()) # I sender sends I listener's port to IIs
# look at ConnectionsCatcher
# I listener accepts connection from II sender
theirAddress, theirPort = address, listenerport
threading._start_new_thread(self.THREAD_listener, ())
示例14: alarm
def alarm(secs):
def wait(secs):
for n in xrange(timeout_secs):
time.sleep(1)
if signal_finished: break
else:
#thread.interrupt_main()
exec_errors.append(SafeEvalTimeoutException(secs).message)
#thread.Start_new_thread(wait, (secs,))
threading._start_new_thread(wait, (secs,))
示例15: __init__
def __init__(self, parent, mylist, header, *args):
QAbstractTableModel.__init__(self, parent, *args)
self.mylist = mylist
self.header = header
self.count = 0
self.timer = QTimer()
#self.timer.setInterval(1)
self.timer.start(1000)
self.timer.timeout.connect(self.timerHit)
threading._start_new_thread(self.updateData, ())