Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
69 lines (54 loc) · 1.39 KB

File metadata and controls

69 lines (54 loc) · 1.39 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# -*- coding: utf-8 -*-
"""
Created on 2018/1/10 14:14
@author: JERRY
"""
#coding=utf-8
__author__ = 'Bruce_Zhou'
import threading
import time
import datetime
num = 0
con = threading.Condition()
class Gov(threading.Thread):
def __init__(self):
super(Gov, self).__init__()
def run(self):
global num
print('庄家获取锁')
con.acquire()
while True:
print ("开始拉升股市")
num += 1
print ("拉升了" + str(num) + "个点")
time.sleep(2)
if num == 5:
print ("暂时安全!")
con.notify()
con.wait()
print('庄家释放锁')
con.release()
class Consumers(threading.Thread):
def __init__(self):
super(Consumers, self).__init__()
def run(self):
global num
print('散户获取锁')
con.acquire()
while True:
if num > 0:
print("开始打压股市")
num -= 1
print("打压了" + str(num) + "个点")
time.sleep(2)
if num == 0:
print("你妹的!天台在哪里!")
con.notify()
con.wait()
print('散户获取锁')
con.release()
if __name__ == '__main__':
p = Gov()
c = Consumers()
p.start()
c.start()
Morty Proxy This is a proxified and sanitized view of the page, visit original site.