Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mitogen
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
mitogen
Commits
9cf889b8
Commit
9cf889b8
authored
Mar 18, 2018
by
David Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
issue #144: master: public/private Pool attributes.
parent
19632473
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
mitogen/service.py
mitogen/service.py
+8
-6
No files found.
mitogen/service.py
View file @
9cf889b8
...
@@ -87,32 +87,34 @@ class Service(object):
...
@@ -87,32 +87,34 @@ class Service(object):
class
Pool
(
object
):
class
Pool
(
object
):
def
__init__
(
self
,
router
,
services
,
size
=
1
):
def
__init__
(
self
,
router
,
services
,
size
=
1
):
self
.
router
=
router
self
.
services
=
list
(
services
)
self
.
services
=
list
(
services
)
self
.
select
=
mitogen
.
master
.
Select
(
self
.
size
=
size
self
.
_select
=
mitogen
.
master
.
Select
(
receivers
=
[
receivers
=
[
service
.
recv
service
.
recv
for
service
in
self
.
services
for
service
in
self
.
services
],
],
oneshot
=
False
,
oneshot
=
False
,
)
)
self
.
threads
=
[]
self
.
_
threads
=
[]
for
x
in
xrange
(
size
):
for
x
in
xrange
(
size
):
thread
=
threading
.
Thread
(
thread
=
threading
.
Thread
(
name
=
'mitogen.service.Pool.worker-%d'
%
(
x
,),
name
=
'mitogen.service.Pool.worker-%d'
%
(
x
,),
target
=
self
.
_worker_main
,
target
=
self
.
_worker_main
,
)
)
thread
.
start
()
thread
.
start
()
self
.
threads
.
append
(
thread
)
self
.
_
threads
.
append
(
thread
)
def
stop
(
self
):
def
stop
(
self
):
self
.
select
.
close
()
self
.
_
select
.
close
()
for
th
in
self
.
threads
:
for
th
in
self
.
_
threads
:
th
.
join
()
th
.
join
()
def
_worker_main
(
self
):
def
_worker_main
(
self
):
while
True
:
while
True
:
try
:
try
:
msg
=
self
.
select
.
get
()
msg
=
self
.
_
select
.
get
()
except
(
mitogen
.
core
.
ChannelError
,
mitogen
.
core
.
LatchError
):
except
(
mitogen
.
core
.
ChannelError
,
mitogen
.
core
.
LatchError
):
e
=
sys
.
exc_info
()[
1
]
e
=
sys
.
exc_info
()[
1
]
LOG
.
error
(
'%r: channel or latch closed, exitting: %s'
,
self
,
e
)
LOG
.
error
(
'%r: channel or latch closed, exitting: %s'
,
self
,
e
)
...
...
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