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


Python threading.stack_size方法代码示例

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


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

示例1: __init__

# 需要导入模块: import threading [as 别名]
# 或者: from threading import stack_size [as 别名]
def __init__(self, taskmaster, num, stack_size):
            """Create a new parallel job given a taskmaster.

            The taskmaster's next_task() method should return the next
            task that needs to be executed, or None if there are no more
            tasks. The taskmaster's executed() method will be called
            for each task when it is successfully executed, or failed()
            will be called if the task failed to execute (i.e. execute()
            raised an exception).

            Note: calls to taskmaster are serialized, but calls to
            execute() on distinct tasks are not serialized, because
            that is the whole point of parallel jobs: they can execute
            multiple tasks simultaneously. """

            self.taskmaster = taskmaster
            self.interrupted = InterruptState()
            self.tp = ThreadPool(num, stack_size, self.interrupted)

            self.maxjobs = num 
开发者ID:Autodesk,项目名称:arnold-usd,代码行数:22,代码来源:Job.py

示例2: __init__

# 需要导入模块: import threading [as 别名]
# 或者: from threading import stack_size [as 别名]
def __init__(self, num, stack_size, interrupted):
            """Create the request and reply queues, and 'num' worker threads.
            
            One must specify the stack size of the worker threads. The
            stack size is specified in kilobytes.
            """
            self.requestQueue = queue.Queue(0)
            self.resultsQueue = queue.Queue(0)

            try:
                prev_size = threading.stack_size(stack_size*1024) 
            except AttributeError, e:
                # Only print a warning if the stack size has been
                # explicitly set.
                if not explicit_stack_size is None:
                    msg = "Setting stack size is unsupported by this version of Python:\n    " + \
                        e.args[0]
                    SCons.Warnings.warn(SCons.Warnings.StackSizeWarning, msg) 
开发者ID:bq,项目名称:web2board,代码行数:20,代码来源:Job.py

示例3: __init__

# 需要导入模块: import threading [as 别名]
# 或者: from threading import stack_size [as 别名]
def __init__(self, taskmaster, num, stack_size):
            """Create a new parallel job given a taskmaster.

            The taskmaster's next_task() method should return the next
            task that needs to be executed, or None if there are no more
            tasks. The taskmaster's executed() method will be called
            for each task when it is successfully executed or failed()
            will be called if the task failed to execute (i.e. execute()
            raised an exception).

            Note: calls to taskmaster are serialized, but calls to
            execute() on distinct tasks are not serialized, because
            that is the whole point of parallel jobs: they can execute
            multiple tasks simultaneously. """

            self.taskmaster = taskmaster
            self.interrupted = InterruptState()
            self.tp = ThreadPool(num, stack_size, self.interrupted)

            self.maxjobs = num 
开发者ID:coin3d,项目名称:pivy,代码行数:22,代码来源:Job.py

示例4: test_various_ops_large_stack

# 需要导入模块: import threading [as 别名]
# 或者: from threading import stack_size [as 别名]
def test_various_ops_large_stack(self):
        if verbose:
            print 'with 1MB thread stack size...'
        try:
            threading.stack_size(0x100000)
        except thread.error:
            if verbose:
                print 'platform does not support changing thread stack size'
            return
        self.test_various_ops()
        threading.stack_size(0)

    # this test is not applicable to jython since
    # 1. Lock is equiv to RLock, so this weird sync behavior won't be seen
    # 2. We use a weak hash map to map these threads
    # 3. This behavior doesn't make sense for Jython since any foreign
    #    Java threads can use the same underlying locks, etc 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:19,代码来源:test_threading.py

示例5: test_various_ops_small_stack

# 需要导入模块: import threading [as 别名]
# 或者: from threading import stack_size [as 别名]
def test_various_ops_small_stack(self):
        if verbose:
            print 'with 256kB thread stack size...'
        try:
            threading.stack_size(262144)
        except thread.error:
            self.skipTest('platform does not support changing thread stack size')
        self.test_various_ops()
        threading.stack_size(0)

    # run with a large thread stack size (1MB) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:13,代码来源:test_threading.py

示例6: test_various_ops_large_stack

# 需要导入模块: import threading [as 别名]
# 或者: from threading import stack_size [as 别名]
def test_various_ops_large_stack(self):
        if verbose:
            print 'with 1MB thread stack size...'
        try:
            threading.stack_size(0x100000)
        except thread.error:
            self.skipTest('platform does not support changing thread stack size')
        self.test_various_ops()
        threading.stack_size(0) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:11,代码来源:test_threading.py

示例7: test_various_ops_small_stack

# 需要导入模块: import threading [as 别名]
# 或者: from threading import stack_size [as 别名]
def test_various_ops_small_stack(self):
        if verbose:
            print 'with 256kB thread stack size...'
        try:
            threading.stack_size(262144)
        except thread.error:
            if verbose:
                print 'platform does not support changing thread stack size'
            return
        self.test_various_ops()
        threading.stack_size(0)

    # run with a large thread stack size (1MB) 
开发者ID:dxwu,项目名称:BinderFilter,代码行数:15,代码来源:test_threading.py

示例8: test_various_ops_large_stack

# 需要导入模块: import threading [as 别名]
# 或者: from threading import stack_size [as 别名]
def test_various_ops_large_stack(self):
        if verbose:
            print 'with 1MB thread stack size...'
        try:
            threading.stack_size(0x100000)
        except thread.error:
            if verbose:
                print 'platform does not support changing thread stack size'
            return
        self.test_various_ops()
        threading.stack_size(0) 
开发者ID:dxwu,项目名称:BinderFilter,代码行数:13,代码来源:test_threading.py

示例9: test_various_ops_small_stack

# 需要导入模块: import threading [as 别名]
# 或者: from threading import stack_size [as 别名]
def test_various_ops_small_stack(self):
        if verbose:
            print('with 256kB thread stack size...')
        try:
            threading.stack_size(262144)
        except _thread.error:
            raise unittest.SkipTest(
                'platform does not support changing thread stack size')
        self.test_various_ops()
        threading.stack_size(0)

    # run with a large thread stack size (1MB) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:14,代码来源:test_threading.py

示例10: test_various_ops_large_stack

# 需要导入模块: import threading [as 别名]
# 或者: from threading import stack_size [as 别名]
def test_various_ops_large_stack(self):
        if verbose:
            print('with 1MB thread stack size...')
        try:
            threading.stack_size(0x100000)
        except _thread.error:
            raise unittest.SkipTest(
                'platform does not support changing thread stack size')
        self.test_various_ops()
        threading.stack_size(0) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:12,代码来源:test_threading.py

示例11: checksingleprocess

# 需要导入模块: import threading [as 别名]
# 或者: from threading import stack_size [as 别名]
def checksingleprocess(ipqueue,cacheResult,max_threads):
    threadlist = []
    threading.stack_size(96 * 1024)
    PRINT('need create max threads count: %d' % (max_threads))
    for i in xrange(1, max_threads + 1):
        ping_thread = Ping(ipqueue,cacheResult)
        ping_thread.setDaemon(True)
        try:
            ping_thread.start()
        except threading.ThreadError as e:
            PRINT('start new thread except: %s,work thread cnt: %d' % (e, Ping.getCount()))
            break
        threadlist.append(ping_thread)
    try:
        quit = False
        while not quit:
            for p in threadlist:
                if p.is_alive():
                    p.join(5)
                elif Ping.getCount() == 0 or cacheResult.queryfinish():
                    quit = True
                    break
    except KeyboardInterrupt:
        PRINT("try to interrupt process")
        ipqueue.queue.clear()
        evt_ipramdomend.set()
    cacheResult.close() 
开发者ID:moonshawdo,项目名称:checkgoogleip,代码行数:29,代码来源:checkip.py


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