• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python thread._count函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中thread._count函数的典型用法代码示例。如果您正苦于以下问题:Python _count函数的具体用法?Python _count怎么用?Python _count使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: setup_class

 def setup_class(cls):
     GenericTestThread.setup_class.im_func(cls)
     # if we cannot start more than, say, 1000 threads on this OS, then
     # we can check that we get the proper error at app-level
     space = cls.space
     lock = thread.allocate_lock()
     lock.acquire()
     def f():
         lock.acquire()
         lock.release()
     start = thread._count()
     try:
         try:
             for i in range(1000):
                 thread.start_new_thread(f, ())
         finally:
             lock.release()
     except (thread.error, MemoryError):
         cls.w_can_start_many_threads = space.wrap(False)
     else:
         cls.w_can_start_many_threads = space.wrap(True)
     # wait a bit to allow all threads to finish now
     remaining = thread._count()
     retries = 0
     while remaining > start:
         retries += 1
         if retries == 200:
             raise Exception("the test's threads don't stop!")
         time.sleep(0.2)
         remaining = thread._count()
开发者ID:abhinavthomas,项目名称:pypy,代码行数:30,代码来源:test_thread.py


示例2: test_thread_count

 def test_thread_count(self):
     import thread, time
     feedback = []
     please_start = []
     def f():
         feedback.append(42)
         self.waitfor(lambda: please_start)
     assert thread._count() == 0
     thread.start_new_thread(f, ())
     self.waitfor(lambda: feedback)
     assert thread._count() == 1
     please_start.append(1)  # trigger
开发者ID:abhinavthomas,项目名称:pypy,代码行数:12,代码来源:test_thread.py


示例3: threading_cleanup

def threading_cleanup(nb_threads):
    _MAX_COUNT = 10
    for count in range(_MAX_COUNT):
        n = thread._count()
        if n == nb_threads:
            break
        time.sleep(0.1)
开发者ID:BillyboyD,项目名称:main,代码行数:7,代码来源:test_support.py


示例4: run2

def run2():
    global state

    print lock.acquire(0)
    print "num threads:", _count()
    state = 1
    print lock.acquire()
    lock.release()
    state = 2
开发者ID:ChinaQuants,项目名称:pyston,代码行数:9,代码来源:thread_test.py


示例5: monitor

def monitor():
    global PASSWORD_DIC, THREAD_COUNT, TIMEOUT, WHITE_LIST
    while True:
        queue_count = na_task.find({"status": 0, "plan": 0}).count()
        if queue_count:
            load = 1
        else:
            ac_count = thread._count()
            load = float(ac_count - 4) / THREAD_COUNT
        if load > 1: load = 1
        if load < 0: load = 0
        na_heart.update({"name": "load"}, {"$set": {"value": load, "up_time": datetime.datetime.now()}})
        PASSWORD_DIC, THREAD_COUNT, TIMEOUT, WHITE_LIST = get_config()
        if load > 0:
            time.sleep(8)
        else:
            time.sleep(60)
开发者ID:qiueer,项目名称:xunfeng,代码行数:17,代码来源:VulScan.py


示例6: init

            plugin_info['add_time'] = time_
            plugin_info['filename'] = plugin_name
            plugin_info['count'] = 0
            del plugin_info['plugin']
            na_plugin.insert(plugin_info)
        except:
            pass


if __name__ == '__main__':
    init()
    PASSWORD_DIC, THREAD_COUNT, TIMEOUT, WHITE_LIST = get_config()
    thread.start_new_thread(monitor, ())
    while True:
        task_id, task_plan, task_target, task_plugin = queue_get()
        if task_id == '':
            time.sleep(10)
            continue
        if PLUGIN_DB:
            del sys.modules[PLUGIN_DB.keys()[0]] # 清理插件缓存
            PLUGIN_DB.clear()
        for task_netloc in task_target:
            while True:
                if int(thread._count()) < THREAD_COUNT:
                    if task_netloc[0] in WHITE_LIST: break
                    thread.start_new_thread(vulscan, (task_id, task_netloc, task_plugin))
                    break
                else:
                    time.sleep(2)
        if task_plan == 0: na_task.update({"_id": task_id}, {"$set": {"status": 2}})
开发者ID:qiueer,项目名称:xunfeng,代码行数:30,代码来源:VulScan.py


示例7: threading_setup

def threading_setup():
    if thread:
        return thread._count(),
    else:
        return 1,
开发者ID:ActiveState,项目名称:php-buildpack-legacy,代码行数:5,代码来源:test_support.py


示例8: syscall

import thread, os, time

#thread.start_new_thread

def syscall(cmd, crap=None):
    os.system(cmd)

#run transition models
thread.start_new_thread(syscall,('python run_LFKT-trans-diff-gauss_L1.py x_axis',0) )
thread.start_new_thread(syscall,('python run_LFKT-trans-diff-gauss_L1.py y_axis',0) )
thread.start_new_thread(syscall,('python run_LFKT-trans-diff-gauss_L1.py center',0) )
thread.start_new_thread(syscall,('python run_LFKT-trans-diff-gauss_L1.py shape',0) )
thread.start_new_thread(syscall,('python run_LFKT-trans-diff-gauss_L1.py spread',0) )
thread.start_new_thread(syscall,('python run_LFKT-trans-diff-gauss_L1.py h_to_d',0) )
thread.start_new_thread(syscall,('python run_LFKT-trans-diff-gauss_L1.py d_to_h',0) )
thread.start_new_thread(syscall,('python run_LFKT-trans-diff-gauss_L1.py histogram',0) )

thread.start_new_thread(syscall,('python run_LFKT-trans-diff_L1.py x_axis',0) )
thread.start_new_thread(syscall,('python run_LFKT-trans-diff_L1.py y_axis',0) )
thread.start_new_thread(syscall,('python run_LFKT-trans-diff_L1.py center',0) )
thread.start_new_thread(syscall,('python run_LFKT-trans-diff_L1.py shape',0) )
thread.start_new_thread(syscall,('python run_LFKT-trans-diff_L1.py spread',0) )
thread.start_new_thread(syscall,('python run_LFKT-trans-diff_L1.py h_to_d',0) )
thread.start_new_thread(syscall,('python run_LFKT-trans-diff_L1.py d_to_h',0) )
thread.start_new_thread(syscall,('python run_LFKT-trans-diff_L1.py histogram',0) )


time.sleep(10)
print "ASDFASDGASDFGASDFG"
print thread._count()
开发者ID:RWArunde,项目名称:ideal-guacamole,代码行数:30,代码来源:run_transdiff_stuff.py


示例9: ins

#!/usr/bin/python

import os,commands,time,socket,thread

def ins(ip):
	#print "chup rh betichod"
	installed=commands.getstatusoutput("sshpass -p darwin ssh {} 'rpm -q sshpass'".format(ip))
	if installed[0]!=0:
		s=commands.getstatusoutput("sshpass -p darwin scp hadoop1/Initiation/sp.rpm   [email protected]{}:/tmp/ ".format(ip))
		#print(s)
		s=commands.getstatusoutput("sshpass -p darwin ssh {} 'rpm -ivh /tmp/sp.rpm' ".format(ip))
		#print s
#listscan=['192.168.43.198','192.168.43.104']
for each in listscan:
	#print each
	s=commands.getstatusoutput("ping -c 1 {}".format(each))
	#print(s[0])	
	thread.start_new_thread(ins,(each,))
	#print thread._count()
while thread._count()!=0:
	time.sleep(3)
print "installer ended"
开发者ID:darwin-clown,项目名称:Daemon,代码行数:22,代码来源:PI.py


示例10: run

def run(arg):
    global done
    with print_lock:
        print "num threads:", _count()
        print "in other thread!", arg
    done = 1
开发者ID:ChinaQuants,项目名称:pyston,代码行数:6,代码来源:thread_test.py


示例11: type

print type(allocate_lock())

print_lock = allocate_lock()

done = 0
def run(arg):
    global done
    with print_lock:
        print "num threads:", _count()
        print "in other thread!", arg
    done = 1


print "starting!"
print "num threads:", _count()
with print_lock:
    t = start_new_thread(run, (5,))
    print type(t)

while not done:
    time.sleep(0)

print "done!"
print "num threads:", _count()

done = False
with print_lock:
    t = start_new_thread(run, (), {'arg': 6})
while not done:
    time.sleep(0)
开发者ID:ChinaQuants,项目名称:pyston,代码行数:30,代码来源:thread_test.py


示例12: print_time

def print_time( threadName, delay):
	count = 0
	while count < 5:
		time.sleep(delay)
		count += 1
		print "%s(%s): %s" % ( threadName, thread._count(), time.ctime(time.time()) )
开发者ID:shunanya,项目名称:Node.js-cluster-monitoring,代码行数:6,代码来源:test_thread.py


示例13: threading_setup

def threading_setup():
	return thread._count(),
开发者ID:BillyboyD,项目名称:main,代码行数:2,代码来源:test_support.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python thread._get_ident函数代码示例发布时间:2022-05-27
下一篇:
Python functions.obtain_valid_painter函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap