forked from microsoft/ptvsd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide a way to suspend and resume all threads. Fixes microsoft#732
- Loading branch information
Showing
8 changed files
with
177 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/bash | ||
set -ev | ||
|
||
pip install pytest==3.6 | ||
pip install pytest | ||
pip install untangle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 19 additions & 5 deletions
24
ptvsd/_vendored/pydevd/tests_python/resources/_debugger_case4.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,22 @@ | ||
import time | ||
|
||
|
||
class ProceedContainer: | ||
proceed = False | ||
|
||
|
||
def exit_while_loop(): | ||
ProceedContainer.proceed = True | ||
return 'ok' | ||
|
||
|
||
def sleep(): | ||
while not ProceedContainer.proceed: # The debugger should change the proceed to True to exit the loop. | ||
time.sleep(.1) | ||
|
||
|
||
if __name__ == '__main__': | ||
for i in range(6): | ||
print('here %s' % i) | ||
time.sleep(1) | ||
|
||
sleep() | ||
|
||
print('TEST SUCEEDED') | ||
|
33 changes: 33 additions & 0 deletions
33
ptvsd/_vendored/pydevd/tests_python/resources/_debugger_case_suspend_all.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import time | ||
import threading | ||
|
||
|
||
class ProceedContainer: | ||
tid_to_proceed = { | ||
1: False, | ||
2: False, | ||
} | ||
|
||
|
||
def exit_while_loop(tid): | ||
ProceedContainer.tid_to_proceed[tid] = True | ||
return 'ok' | ||
|
||
|
||
def thread_func(tid): | ||
while not ProceedContainer.tid_to_proceed[tid]: # The debugger should change the proceed to True to exit the loop. | ||
time.sleep(.1) | ||
|
||
|
||
if __name__ == '__main__': | ||
threads = [ | ||
threading.Thread(target=thread_func, args=(1,)), | ||
threading.Thread(target=thread_func, args=(2,)), | ||
] | ||
for t in threads: | ||
t.start() | ||
|
||
for t in threads: | ||
t.join() | ||
|
||
print('TEST SUCEEDED') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters