本文整理汇总了Python中thread.stack_size方法的典型用法代码示例。如果您正苦于以下问题:Python thread.stack_size方法的具体用法?Python thread.stack_size怎么用?Python thread.stack_size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thread
的用法示例。
在下文中一共展示了thread.stack_size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_stack_size
# 需要导入模块: import thread [as 别名]
# 或者: from thread import stack_size [as 别名]
def test_stack_size(self):
import sys
if is_cli or (sys.version_info[0] == 2 and sys.version_info[1] > 4) or sys.version_info[0] > 2:
import thread
size = thread.stack_size()
self.assertTrue(size==0 or size>=32768)
bad_size_list = [ 1, -1, -32768, -32769, -32767, -40000, 32767, 32766]
for bad_size in bad_size_list:
self.assertRaises(ValueError, thread.stack_size, bad_size)
good_size_list = [4096*10, 4096*100, 4096*1000, 4096*10000]
for good_size in good_size_list:
#CodePlex Work Item 7827
if is_cli and good_size<=50000: print "Ignoring", good_size, "for CLI"; continue
temp = thread.stack_size(good_size)
self.assertTrue(temp>=32768 or temp==0)
def temp(): pass
thread.start_new_thread(temp, ())
temp = thread.stack_size(1024*1024)
self.assertTrue(temp>=32768 or temp==0)
示例2: stack_size
# 需要导入模块: import thread [as 别名]
# 或者: from thread import stack_size [as 别名]
def stack_size(size=None):
"""Dummy implementation of thread.stack_size()."""
if size is not None:
raise error("setting thread stack size not supported")
return 0
示例3: stack_size
# 需要导入模块: import thread [as 别名]
# 或者: from thread import stack_size [as 别名]
def stack_size(size=None):
if size is None:
return _original_stack_size()
if size > _original_stack_size():
return _original_stack_size(size)
else:
pass
# not going to decrease stack_size, because otherwise other greenlets in this thread will suffer