smelond's recent timeline updates
smelond

smelond

V2EX member #347010, joined on 2018-09-04 15:49:21 +08:00
smelond's recent replies
Jan 6, 2019
Replied to a topic by smelond Python Python 关于多线程和多进程同时共用问题
@lihongjie0209 放到全局变量里面 不管怎么样,test 函数就是不识别
Jan 6, 2019
Replied to a topic by smelond Python Python 关于多线程和多进程同时共用问题
@ysc3839 不好意思,感谢你的回复,感觉可能惹你生气了,我对 Python 也不是太熟练,听到你说了在 test1 里面初始化 SEM,我想了一下,想到了我可以先将:
sem = int(args.THREAD)
time_out = int(args.OVERTIME)
放到 main 函数里面,然后通过传参方式,从 mian-> test1->test 最后直接在 test 里面写入
with threading.Semaphore(sem): 然后可以成功的运行,感谢你的回复
Jan 6, 2019
Replied to a topic by smelond Python Python 关于多线程和多进程同时共用问题
@ysc3839 咋个初始化呢,是这样么? 但是这样之后程序一秒运行完成,没有执行里面的操作
``` python

global SEM
SEM = threading.Semaphore(int(args.THREAD))
```
Jan 6, 2019
Replied to a topic by smelond Python Python 关于多线程和多进程同时共用问题
@ysc3839 请问这个还有办法解决吗
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5963 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 18ms · UTC 06:10 · PVG 14:10 · LAX 23:10 · JFK 02:10
♥ Do have faith in what you're doing.