File: osthreads.py

package info (click to toggle)
python-eventlet 0.40.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,200 kB
  • sloc: python: 25,101; sh: 78; makefile: 31
file content (25 lines) | stat: -rw-r--r-- 438 bytes parent folder | download | duplicates (3)
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
import eventlet
import eventlet.patcher

eventlet.monkey_patch()

threading_orig = eventlet.patcher.original("threading")

EVENTS = []


def os_thread_2():
    eventlet.sleep(0.1)
    EVENTS.append(2)
    eventlet.sleep(0.1)
    EVENTS.append(2)


threading_orig.Thread(target=os_thread_2).start()
EVENTS.append(1)
eventlet.sleep(0.05)
EVENTS.append(1)
eventlet.sleep(0.4)
EVENTS.append(3)
if EVENTS == [1, 1, 2, 2, 3]:
    print("pass")