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
4e7b1453
Commit
4e7b1453
authored
Aug 13, 2009
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gevent.Greenlet: allow spawn with no parameters
parent
b13f582f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
gevent/greenlet.py
gevent/greenlet.py
+3
-2
No files found.
gevent/greenlet.py
View file @
4e7b1453
...
@@ -135,6 +135,7 @@ class FailureGreenletLink(GreenletLink):
...
@@ -135,6 +135,7 @@ class FailureGreenletLink(GreenletLink):
if
not
source
.
successful
():
if
not
source
.
successful
():
return
GreenletLink
.
__call__
(
self
,
source
)
return
GreenletLink
.
__call__
(
self
,
source
)
class
Greenlet
(
greenlet
):
class
Greenlet
(
greenlet
):
# QQQ rename to Microthread
# QQQ rename to Microthread
"""A greenlet subclass that adds a few features.
"""A greenlet subclass that adds a few features.
...
@@ -201,7 +202,7 @@ class Greenlet(greenlet):
...
@@ -201,7 +202,7 @@ class Greenlet(greenlet):
return
core
.
timer
(
seconds
,
self
.
switch
,
*
args
)
return
core
.
timer
(
seconds
,
self
.
switch
,
*
args
)
@
classmethod
@
classmethod
def
spawn
(
cls
,
function
,
*
args
,
**
kwargs
):
def
spawn
(
cls
,
function
=
None
,
*
args
,
**
kwargs
):
if
kwargs
:
if
kwargs
:
g
=
cls
(
_switch_helper
)
g
=
cls
(
_switch_helper
)
g
.
start
(
function
,
args
,
kwargs
)
g
.
start
(
function
,
args
,
kwargs
)
...
@@ -212,7 +213,7 @@ class Greenlet(greenlet):
...
@@ -212,7 +213,7 @@ class Greenlet(greenlet):
return
g
return
g
@
classmethod
@
classmethod
def
spawn_later
(
cls
,
seconds
,
function
,
*
args
,
**
kwargs
):
def
spawn_later
(
cls
,
seconds
,
function
=
None
,
*
args
,
**
kwargs
):
if
kwargs
:
if
kwargs
:
g
=
cls
(
_switch_helper
)
g
=
cls
(
_switch_helper
)
timer
=
g
.
start_later
(
seconds
,
function
,
args
,
kwargs
)
timer
=
g
.
start_later
(
seconds
,
function
,
args
,
kwargs
)
...
...
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