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


Python threading._start_new_thread方法代码示例

本文整理汇总了Python中threading._start_new_thread方法的典型用法代码示例。如果您正苦于以下问题:Python threading._start_new_thread方法的具体用法?Python threading._start_new_thread怎么用?Python threading._start_new_thread使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在threading的用法示例。


在下文中一共展示了threading._start_new_thread方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: intercept_threads

# 需要导入模块: import threading [as 别名]
# 或者: from threading import _start_new_thread [as 别名]
def intercept_threads(for_attach = False):
    thread.start_new_thread = thread_creator
    thread.start_new = thread_creator

    # If threading has already been imported (i.e. we're attaching), we must hot-patch threading._start_new_thread
    # so that new threads started using it will be intercepted by our code.
    #
    # On the other hand, if threading has not been imported, we must not import it ourselves, because it will then
    # treat the current thread as the main thread, which is incorrect when attaching because this code is executing
    # on an ephemeral debugger attach thread that will go away shortly. We don't need to hot-patch it in that case
    # anyway, because it will pick up the new thread.start_new_thread that we have set above when it's imported.
    global _threading
    if _threading is None and 'threading' in sys.modules:
        import threading
        _threading = threading
        _threading._start_new_thread = thread_creator

    global _INTERCEPTING_FOR_ATTACH
    _INTERCEPTING_FOR_ATTACH = for_attach 
开发者ID:ms-iot,项目名称:iot-utilities,代码行数:21,代码来源:visualstudio_py_debugger.py

示例2: Cping

# 需要导入模块: import threading [as 别名]
# 或者: from threading import _start_new_thread [as 别名]
def Cping(ip): 
    if '/24' in ip:
        ipc = (ip.split('.')[:-1])
        for i in range(1,256):
            add = ('.'.join(ipc)+'.'+str(i))
            threading._start_new_thread(pingIP,(add,))
            time.sleep(0.1)

        #ipcc = scanip.split('.')[:-1]
        #ipccc = ('.'.join(ipcc)+'.')
        #global ipc 
        #ipc = ipccc
        #ipc = scanip.split('.')[:-1]
        #print "ipc: "+ipc

        # pool = Pool(255) 
        # pool.map(CpingIP,xrange(1,254)) 
        # pool.join()
    else:
        pingIP(ip) 
开发者ID:k8gege,项目名称:K8CScan,代码行数:22,代码来源:K8Cscan.py

示例3: test_limbo_cleanup

# 需要导入模块: import threading [as 别名]
# 或者: from threading import _start_new_thread [as 别名]
def test_limbo_cleanup(self):
        # Issue 7481: Failure to start thread should cleanup the limbo map.
        def fail_new_thread(*args):
            raise thread.error()
        _start_new_thread = threading._start_new_thread
        threading._start_new_thread = fail_new_thread
        try:
            t = threading.Thread(target=lambda: None)
            self.assertRaises(thread.error, t.start)
            self.assertFalse(
                t in threading._limbo,
                "Failed to cleanup _limbo map on failure of Thread.start().")
        finally:
            threading._start_new_thread = _start_new_thread 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:16,代码来源:test_threading.py

示例4: test_limbo_cleanup

# 需要导入模块: import threading [as 别名]
# 或者: from threading import _start_new_thread [as 别名]
def test_limbo_cleanup(self):
        # Issue 7481: Failure to start thread should cleanup the limbo map.
        def fail_new_thread(*args):
            raise threading.ThreadError()
        _start_new_thread = threading._start_new_thread
        threading._start_new_thread = fail_new_thread
        try:
            t = threading.Thread(target=lambda: None)
            self.assertRaises(threading.ThreadError, t.start)
            self.assertFalse(
                t in threading._limbo,
                "Failed to cleanup _limbo map on failure of Thread.start().")
        finally:
            threading._start_new_thread = _start_new_thread 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:16,代码来源:test_threading.py

示例5: thread_creator

# 需要导入模块: import threading [as 别名]
# 或者: from threading import _start_new_thread [as 别名]
def thread_creator(func, args, kwargs = {}, *extra_args):
    if not isinstance(args, tuple):
        # args is not a tuple. This may be because we have become bound to a
        # class, which has offset our arguments by one.
        if isinstance(kwargs, tuple):
            func, args = args, kwargs
            kwargs = extra_args[0] if len(extra_args) > 0 else {}

    return _start_new_thread(new_thread_wrapper, (func, args, kwargs)) 
开发者ID:ms-iot,项目名称:iot-utilities,代码行数:11,代码来源:visualstudio_py_debugger.py

示例6: command_connect_repl

# 需要导入模块: import threading [as 别名]
# 或者: from threading import _start_new_thread [as 别名]
def command_connect_repl(self):
        port_num = read_int(self.conn)
        _start_new_thread(self.connect_to_repl_backend, (port_num,)) 
开发者ID:ms-iot,项目名称:iot-utilities,代码行数:5,代码来源:visualstudio_py_debugger.py

示例7: detach_process

# 需要导入模块: import threading [as 别名]
# 或者: from threading import _start_new_thread [as 别名]
def detach_process():
    global DETACHED
    DETACHED = True
    if not _INTERCEPTING_FOR_ATTACH:
        if isinstance(sys.stdout, _DebuggerOutput): 
            sys.stdout = sys.stdout.old_out
        if isinstance(sys.stderr, _DebuggerOutput):
            sys.stderr = sys.stderr.old_out

    if not _INTERCEPTING_FOR_ATTACH:
        thread.start_new_thread = _start_new_thread
        thread.start_new = _start_new_thread 
开发者ID:ms-iot,项目名称:iot-utilities,代码行数:14,代码来源:visualstudio_py_debugger.py

示例8: connect_repl_using_socket

# 需要导入模块: import threading [as 别名]
# 或者: from threading import _start_new_thread [as 别名]
def connect_repl_using_socket(sock):
    _start_new_thread(DebuggerLoop.instance.connect_to_repl_backend_using_socket, (sock,)) 
开发者ID:ms-iot,项目名称:iot-utilities,代码行数:4,代码来源:visualstudio_py_debugger.py

示例9: ScanSmbVul

# 需要导入模块: import threading [as 别名]
# 或者: from threading import _start_new_thread [as 别名]
def ScanSmbVul(ip): 
    if '/24' in ip:
        ipc = (ip.split('.')[:-1])
        for i in range(1,256):
            add = ('.'.join(ipc)+'.'+str(i))
            threading._start_new_thread(GetSmbVul,(add,))
            time.sleep(0.1)
    else:
        GetSmbVul(ip) 
开发者ID:k8gege,项目名称:K8CScan,代码行数:11,代码来源:K8Cscan.py

示例10: Cscan

# 需要导入模块: import threading [as 别名]
# 或者: from threading import _start_new_thread [as 别名]
def Cscan(ip): 
    if '/24' in ip:
        ipc = (ip.split('.')[:-1])
        for i in range(1,256):
            add = ('.'.join(ipc)+'.'+str(i))
            threading._start_new_thread(netscan,(add,))
            # if type=='dll':
                # threading._start_new_thread(netscan,(add,))
            # elif type=='smb':
                # threading._start_new_thread(netscan,(add,))
            time.sleep(0.1)
    else:
        netscan(ip) 
开发者ID:k8gege,项目名称:K8CScan,代码行数:15,代码来源:K8Cscan.py

示例11: CscanSMBver

# 需要导入模块: import threading [as 别名]
# 或者: from threading import _start_new_thread [as 别名]
def CscanSMBver(ip): 
    if '/24' in ip:
        ipc = (ip.split('.')[:-1])
        for i in range(1,256):
            add = ('.'.join(ipc)+'.'+str(i))
            threading._start_new_thread(smbVersion,(add,))
            time.sleep(0.1)
    else:
        smbVersion(ip) 
开发者ID:k8gege,项目名称:K8CScan,代码行数:11,代码来源:K8Cscan.py

示例12: CscanOSname

# 需要导入模块: import threading [as 别名]
# 或者: from threading import _start_new_thread [as 别名]
def CscanOSname(ip): 
    if '/24' in ip:
        ipc = (ip.split('.')[:-1])
        for i in range(1,256):
            add = ('.'.join(ipc)+'.'+str(i))
            threading._start_new_thread(GetOSname,(add,))
            time.sleep(0.1)
    else:
        GetOSname(ip) 
开发者ID:k8gege,项目名称:K8CScan,代码行数:11,代码来源:K8Cscan.py


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