Last change
on this file since 75443 was 75443, checked in by vboxsync, 6 years ago |
Exported Mesa related code to OSE.
|
-
Property svn:eol-style
set to
LF
|
File size:
677 bytes
|
Line | |
---|
1 | import sys
|
---|
2 |
|
---|
3 | # Monkey patch os.spawnve on windows to become thread safe
|
---|
4 | if sys.platform == 'win32':
|
---|
5 | import os
|
---|
6 | import threading
|
---|
7 | from os import spawnve as old_spawnve
|
---|
8 |
|
---|
9 | spawn_lock = threading.Lock()
|
---|
10 |
|
---|
11 | def new_spawnve(mode, file, args, env):
|
---|
12 | spawn_lock.acquire()
|
---|
13 | try:
|
---|
14 | if mode == os.P_WAIT:
|
---|
15 | ret = old_spawnve(os.P_NOWAIT, file, args, env)
|
---|
16 | else:
|
---|
17 | ret = old_spawnve(mode, file, args, env)
|
---|
18 | finally:
|
---|
19 | spawn_lock.release()
|
---|
20 | if mode == os.P_WAIT:
|
---|
21 | pid, status = os.waitpid(ret, 0)
|
---|
22 | ret = status >> 8
|
---|
23 | return ret
|
---|
24 |
|
---|
25 | os.spawnve = new_spawnve
|
---|
26 |
|
---|
27 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.