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
26cdf1fe
Kaydet (Commit)
26cdf1fe
authored
May 26, 2012
tarafından
Richard Oudkerk
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Make multiprocessing's shared memory use memoryview instead of raw pointer
üst
1a0df94d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
26 deletions
+5
-26
heap.py
Lib/multiprocessing/heap.py
+3
-8
sharedctypes.py
Lib/multiprocessing/sharedctypes.py
+2
-1
multiprocessing.c
Modules/_multiprocessing/multiprocessing.c
+0
-17
No files found.
Lib/multiprocessing/heap.py
Dosyayı görüntüle @
26cdf1fe
...
...
@@ -205,7 +205,7 @@ class Heap(object):
self
.
_lock
.
release
()
#
# Class representing a chunk of an mmap -- can be inherited
# Class representing a chunk of an mmap -- can be inherited
by child process
#
class
BufferWrapper
(
object
):
...
...
@@ -218,11 +218,6 @@ class BufferWrapper(object):
self
.
_state
=
(
block
,
size
)
Finalize
(
self
,
BufferWrapper
.
_heap
.
free
,
args
=
(
block
,))
def
get_address
(
self
):
def
create_memoryview
(
self
):
(
arena
,
start
,
stop
),
size
=
self
.
_state
address
,
length
=
_multiprocessing
.
address_of_buffer
(
arena
.
buffer
)
assert
size
<=
length
return
address
+
start
def
get_size
(
self
):
return
self
.
_state
[
1
]
return
memoryview
(
arena
.
buffer
)[
start
:
start
+
size
]
Lib/multiprocessing/sharedctypes.py
Dosyayı görüntüle @
26cdf1fe
...
...
@@ -132,7 +132,8 @@ def rebuild_ctype(type_, wrapper, length):
if
length
is
not
None
:
type_
=
type_
*
length
ForkingPickler
.
register
(
type_
,
reduce_ctype
)
obj
=
type_
.
from_address
(
wrapper
.
get_address
())
buf
=
wrapper
.
create_memoryview
()
obj
=
type_
.
from_buffer
(
buf
)
obj
.
_wrapper
=
wrapper
return
obj
...
...
Modules/_multiprocessing/multiprocessing.c
Dosyayı görüntüle @
26cdf1fe
...
...
@@ -51,20 +51,6 @@ mp_SetError(PyObject *Type, int num)
return
NULL
;
}
static
PyObject
*
multiprocessing_address_of_buffer
(
PyObject
*
self
,
PyObject
*
obj
)
{
void
*
buffer
;
Py_ssize_t
buffer_len
;
if
(
PyObject_AsWriteBuffer
(
obj
,
&
buffer
,
&
buffer_len
)
<
0
)
return
NULL
;
return
Py_BuildValue
(
"Nn"
,
PyLong_FromVoidPtr
(
buffer
),
buffer_len
);
}
#ifdef MS_WINDOWS
static
PyObject
*
multiprocessing_closesocket
(
PyObject
*
self
,
PyObject
*
args
)
...
...
@@ -137,9 +123,6 @@ multiprocessing_send(PyObject *self, PyObject *args)
*/
static
PyMethodDef
module_methods
[]
=
{
{
"address_of_buffer"
,
multiprocessing_address_of_buffer
,
METH_O
,
"address_of_buffer(obj) -> int
\n
"
"Return address of obj assuming obj supports buffer inteface"
},
#ifdef MS_WINDOWS
{
"closesocket"
,
multiprocessing_closesocket
,
METH_VARARGS
,
""
},
{
"recv"
,
multiprocessing_recv
,
METH_VARARGS
,
""
},
...
...
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