Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
14453480
Commit
14453480
authored
Sep 24, 2010
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove deprecated module rawgreenlet
parent
2afe19a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
91 deletions
+0
-91
gevent/rawgreenlet.py
gevent/rawgreenlet.py
+0
-91
No files found.
gevent/rawgreenlet.py
deleted
100644 → 0
View file @
2afe19a6
# Copyright (c) 2009-2010 Denis Bilenko. See LICENSE for details.
"""A few utilities for raw greenlets.
.. warning::
This module is deprecated. Use :class:`gevent.Greenlet` instead.
.. note::
These functions do not support *timeout* parameter.
"""
import
warnings
warnings
.
warn
(
"gevent.rawgreenlet is deprecated"
,
DeprecationWarning
,
stacklevel
=
2
)
import
traceback
from
gevent
import
core
from
gevent.hub
import
GreenletExit
,
Waiter
,
sleep
__all__
=
[
'kill'
,
'killall'
,
'join'
,
'joinall'
]
def
_kill
(
greenlet
,
exception
,
waiter
):
try
:
greenlet
.
throw
(
exception
)
except
:
traceback
.
print_exc
()
waiter
.
switch
()
def
kill
(
greenlet
,
exception
=
GreenletExit
,
block
=
True
,
polling_period
=
0.2
):
"""Kill greenlet with exception (GreenletExit by default).
Wait for it to die if block is true.
"""
if
not
greenlet
.
dead
:
waiter
=
Waiter
()
core
.
active_event
(
_kill
,
greenlet
,
exception
,
waiter
)
if
block
:
waiter
.
wait
()
join
(
greenlet
,
polling_period
=
polling_period
)
def
_killall
(
greenlets
,
exception
,
waiter
):
diehards
=
[]
for
greenlet
in
greenlets
:
if
not
greenlet
.
dead
:
try
:
greenlet
.
throw
(
exception
)
except
:
traceback
.
print_exc
()
if
not
greenlet
.
dead
:
diehards
.
append
(
greenlet
)
waiter
.
switch
(
diehards
)
def
killall
(
greenlets
,
exception
=
GreenletExit
,
block
=
True
,
polling_period
=
0.2
):
"""Kill all the greenlets with exception (GreenletExit by default).
Wait for them to die if block is true.
"""
waiter
=
Waiter
()
core
.
active_event
(
_killall
,
greenlets
,
exception
,
waiter
)
if
block
:
alive
=
waiter
.
wait
()
if
alive
:
joinall
(
alive
,
polling_period
=
polling_period
)
def
join
(
greenlet
,
polling_period
=
0.2
):
"""Wait for a greenlet to finish by polling its status"""
delay
=
0.002
while
not
greenlet
.
dead
:
delay
=
min
(
polling_period
,
delay
*
2
)
sleep
(
delay
)
def
joinall
(
greenlets
,
polling_period
=
0.2
):
"""Wait for the greenlets to finish by polling their status"""
current
=
0
while
current
<
len
(
greenlets
)
and
greenlets
[
current
].
dead
:
current
+=
1
delay
=
0.002
while
current
<
len
(
greenlets
):
delay
=
min
(
polling_period
,
delay
*
2
)
sleep
(
delay
)
while
current
<
len
(
greenlets
)
and
greenlets
[
current
].
dead
:
current
+=
1
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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