Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
4b76f8a7
Kaydet (Commit)
4b76f8a7
authored
Ara 31, 2011
tarafından
Eli Bendersky
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Some formatting & grammar fixes for the multiprocessing doc
üst
c016f46d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
17 deletions
+17
-17
multiprocessing.rst
Doc/library/multiprocessing.rst
+17
-17
No files found.
Doc/library/multiprocessing.rst
Dosyayı görüntüle @
4b76f8a7
...
...
@@ -282,7 +282,7 @@ For example::
if __name__ == '
__main__
':
pool = Pool(processes=4) # start 4 worker processes
result = pool.apply_async(f, [10])
# evaluate "f(10)" asynchronously
result = pool.apply_async(f, [10]) # evaluate "f(10)" asynchronously
print result.get(timeout=1) # prints "100" unless your computer is *very* slow
print pool.map(f, range(10)) # prints "[0, 1, 4,..., 81]"
...
...
@@ -472,7 +472,7 @@ into Python 2.5's :class:`Queue.Queue` class.
If
you
use
:
class
:`
JoinableQueue
`
then
you
**
must
**
call
:
meth
:`
JoinableQueue
.
task_done
`
for
each
task
removed
from
the
queue
or
else
the
semaphore
used
to
count
the
number
of
unfinished
tasks
may
eventually
overflow
semaphore
used
to
count
the
number
of
unfinished
tasks
may
eventually
overflow
,
raising
an
exception
.
Note
that
one
can
also
create
a
shared
queue
by
using
a
manager
object
--
see
...
...
@@ -490,7 +490,7 @@ Note that one can also create a shared queue by using a manager object -- see
If
a
process
is
killed
using
:
meth
:`
Process
.
terminate
`
or
:
func
:`
os
.
kill
`
while
it
is
trying
to
use
a
:
class
:`
Queue
`,
then
the
data
in
the
queue
is
likely
to
become
corrupted
.
This
may
cause
any
other
process
es
to
get
an
likely
to
become
corrupted
.
This
may
cause
any
other
process
to
get
an
exception
when
it
tries
to
use
the
queue
later
on
.
..
warning
::
...
...
@@ -692,7 +692,7 @@ Miscellaneous
(
By
default
:
data
:`
sys
.
executable
`
is
used
).
Embedders
will
probably
need
to
do
some
thing
like
::
set
E
xecutable
(
os
.
path
.
join
(
sys
.
exec_prefix
,
'pythonw.exe'
))
set
_e
xecutable
(
os
.
path
.
join
(
sys
.
exec_prefix
,
'pythonw.exe'
))
before
they
can
create
child
processes
.
(
Windows
only
)
...
...
@@ -711,7 +711,7 @@ Connection Objects
Connection
objects
allow
the
sending
and
receiving
of
picklable
objects
or
strings
.
They
can
be
thought
of
as
message
oriented
connected
sockets
.
Connection
objects
usually
created
using
:
func
:`
Pipe
`
--
see
also
Connection
objects
are
usually
created
using
:
func
:`
Pipe
`
--
see
also
:
ref
:`
multiprocessing
-
listeners
-
clients
`.
..
class
::
Connection
...
...
@@ -722,7 +722,7 @@ Connection objects usually created using :func:`Pipe` -- see also
using
:
meth
:`
recv
`.
The
object
must
be
picklable
.
Very
large
pickles
(
approximately
32
MB
+,
though
it
depends
on
the
OS
)
may
raise
a
ValueError
exception
.
though
it
depends
on
the
OS
)
may
raise
a
:
exc
:`
ValueError
`
exception
.
..
method
::
recv
()
...
...
@@ -732,7 +732,7 @@ Connection objects usually created using :func:`Pipe` -- see also
..
method
::
fileno
()
Return
s
the
file
descriptor
or
handle
used
by
the
connection
.
Return
the
file
descriptor
or
handle
used
by
the
connection
.
..
method
::
close
()
...
...
@@ -756,7 +756,7 @@ Connection objects usually created using :func:`Pipe` -- see also
If
*
offset
*
is
given
then
data
is
read
from
that
position
in
*
buffer
*.
If
*
size
*
is
given
then
that
many
bytes
will
be
read
from
buffer
.
Very
large
buffers
(
approximately
32
MB
+,
though
it
depends
on
the
OS
)
may
raise
a
ValueError
exception
:
exc
:`
ValueError
`
exception
..
method
::
recv_bytes
([
maxlength
])
...
...
@@ -1329,7 +1329,7 @@ Customized managers
>>>>>>>>>>>>>>>>>>>
To
create
one
's own manager, one creates a subclass of :class:`BaseManager` and
use the :meth:`~BaseManager.register` classmethod to register new types or
use
s
the :meth:`~BaseManager.register` classmethod to register new types or
callables with the manager class. For example::
from multiprocessing.managers import BaseManager
...
...
@@ -1579,10 +1579,10 @@ with the :class:`Pool` class.
..
method
::
apply
(
func
[,
args
[,
kwds
]])
Equivalent
of
the
:
func
:`
apply
`
built
-
in
function
.
It
blocks
til
l
the
result
is
ready
.
Given
this
blocks
,
:
meth
:`
apply_async
`
is
better
suited
for
performing
work
in
parallel
.
Additionally
,
the
passed
in
function
is
only
executed
in
one
of
the
workers
of
the
pool
.
Equivalent
of
the
:
func
:`
apply
`
built
-
in
function
.
It
blocks
unti
l
the
result
is
ready
,
so
:
meth
:`
apply_async
`
is
better
suited
for
performing
work
in
parallel
.
Additionally
,
*
func
*
is
only
executed
in
one
of
the
workers
of
the
pool
.
..
method
::
apply_async
(
func
[,
args
[,
kwds
[,
callback
]]])
...
...
@@ -1596,7 +1596,7 @@ with the :class:`Pool` class.
..
method
::
map
(
func
,
iterable
[,
chunksize
])
A
parallel
equivalent
of
the
:
func
:`
map
`
built
-
in
function
(
it
supports
only
one
*
iterable
*
argument
though
).
It
blocks
til
l
the
result
is
ready
.
one
*
iterable
*
argument
though
).
It
blocks
unti
l
the
result
is
ready
.
This
method
chops
the
iterable
into
a
number
of
chunks
which
it
submits
to
the
process
pool
as
separate
tasks
.
The
(
approximate
)
size
of
these
...
...
@@ -2046,7 +2046,7 @@ Better to inherit than pickle/unpickle
On
Windows
many
types
from
:
mod
:`
multiprocessing
`
need
to
be
picklable
so
that
child
processes
can
use
them
.
However
,
one
should
generally
avoid
sending
shared
objects
to
other
processes
using
pipes
or
queues
.
Instead
you
should
arrange
the
program
so
that
a
process
which
need
access
to
a
you
should
arrange
the
program
so
that
a
process
which
need
s
access
to
a
shared
resource
created
elsewhere
can
inherit
it
from
an
ancestor
process
.
Avoid
terminating
processes
...
...
@@ -2125,7 +2125,7 @@ Explicitly pass resources to child processes
for
i
in
range
(
10
):
Process
(
target
=
f
,
args
=(
lock
,)).
start
()
Beware
replacing
sys
.
stdin
with
a
"file like object"
Beware
of
replacing
:
data
:`
sys
.
stdin
`
with
a
"file like object"
:
mod
:`
multiprocessing
`
originally
unconditionally
called
::
...
...
@@ -2243,7 +2243,7 @@ Synchronization types like locks, conditions and queues:
An example showing how to use queues to feed tasks to a collection of worker
process and collect the results:
process
es
and collect the results:
.. literalinclude:: ../includes/mp_workers.py
...
...
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