Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
rdteam
python-examples
Commits
a13c13ad
Commit
a13c13ad
authored
May 05, 2015
by
Bstrdsmkr
Browse files
Add simple threading example
parent
500294a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
threads.py
0 → 100644
View file @
a13c13ad
import
time
from
threading
import
Thread
def
do_thing_1
(
name
):
while
True
:
print
"
\n
His name was {}
\n
"
.
format
(
name
)
time
.
sleep
(
60
)
# For functions that take arguments
thing_one
=
Thread
(
target
=
do_thing_1
,
args
=
(
"Robert Paulson"
,))
# For functions without arguments, just:
# thing_one = Thread(target=do_thing_1)
thing_one
.
daemon
=
True
thing_one
.
start
()
while
True
:
raw_input
(
'Say something: '
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment