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
8fb9f4cf
Kaydet (Commit)
8fb9f4cf
authored
Eki 07, 2012
tarafından
Richard Oudkerk
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Get rid of circular import and eliminate unprefixed exported symbols
from _multiprocessing.
üst
81901490
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
26 deletions
+15
-26
multiprocessing.c
Modules/_multiprocessing/multiprocessing.c
+6
-15
multiprocessing.h
Modules/_multiprocessing/multiprocessing.h
+2
-4
semaphore.c
Modules/_multiprocessing/semaphore.c
+7
-7
No files found.
Modules/_multiprocessing/multiprocessing.c
Dosyayı görüntüle @
8fb9f4cf
...
...
@@ -10,14 +10,12 @@
#include "multiprocessing.h"
PyObject
*
ProcessError
,
*
BufferTooShort
;
/*
* Function which raises exceptions based on error codes
*/
PyObject
*
m
p_SetError
(
PyObject
*
Type
,
int
num
)
_PyM
p_SetError
(
PyObject
*
Type
,
int
num
)
{
switch
(
num
)
{
#ifdef MS_WINDOWS
...
...
@@ -159,19 +157,12 @@ PyInit__multiprocessing(void)
if
(
!
module
)
return
NULL
;
/* Get copy of BufferTooShort */
temp
=
PyImport_ImportModule
(
"multiprocessing"
);
if
(
!
temp
)
return
NULL
;
BufferTooShort
=
PyObject_GetAttrString
(
temp
,
"BufferTooShort"
);
Py_XDECREF
(
temp
);
#if defined(MS_WINDOWS) || \
(defined(HAVE_SEM_OPEN) && !defined(POSIX_SEMAPHORES_NOT_ENABLED))
/* Add SemLock type to module */
if
(
PyType_Ready
(
&
SemLockType
)
<
0
)
/* Add
_PyMp_
SemLock type to module */
if
(
PyType_Ready
(
&
_PyMp_
SemLockType
)
<
0
)
return
NULL
;
Py_INCREF
(
&
SemLockType
);
Py_INCREF
(
&
_PyMp_
SemLockType
);
{
PyObject
*
py_sem_value_max
;
/* Some systems define SEM_VALUE_MAX as an unsigned value that
...
...
@@ -182,10 +173,10 @@ PyInit__multiprocessing(void)
py_sem_value_max
=
PyLong_FromLong
(
SEM_VALUE_MAX
);
if
(
py_sem_value_max
==
NULL
)
return
NULL
;
PyDict_SetItemString
(
SemLockType
.
tp_dict
,
"SEM_VALUE_MAX"
,
PyDict_SetItemString
(
_PyMp_
SemLockType
.
tp_dict
,
"SEM_VALUE_MAX"
,
py_sem_value_max
);
}
PyModule_AddObject
(
module
,
"SemLock"
,
(
PyObject
*
)
&
SemLockType
);
PyModule_AddObject
(
module
,
"SemLock"
,
(
PyObject
*
)
&
_PyMp_
SemLockType
);
#endif
/* Add configuration macros */
...
...
Modules/_multiprocessing/multiprocessing.h
Dosyayı görüntüle @
8fb9f4cf
...
...
@@ -91,15 +91,13 @@
#define MP_SOCKET_ERROR (-1002)
#define MP_EXCEPTION_HAS_BEEN_SET (-1003)
PyObject
*
m
p_SetError
(
PyObject
*
Type
,
int
num
);
PyObject
*
_PyM
p_SetError
(
PyObject
*
Type
,
int
num
);
/*
* Externs - not all will really exist on all platforms
*/
extern
PyObject
*
BufferTooShort
;
extern
PyTypeObject
SemLockType
;
extern
PyTypeObject
PipeConnectionType
;
extern
PyTypeObject
_PyMp_SemLockType
;
/*
* Miscellaneous
...
...
Modules/_multiprocessing/semaphore.c
Dosyayı görüntüle @
8fb9f4cf
...
...
@@ -193,7 +193,7 @@ semlock_release(SemLockObject *self, PyObject *args)
#ifndef HAVE_SEM_TIMEDWAIT
# define sem_timedwait(sem,deadline) sem_timedwait_save(sem,deadline,_save)
int
static
int
sem_timedwait_save
(
sem_t
*
sem
,
struct
timespec
*
deadline
,
PyThreadState
*
_save
)
{
int
res
;
...
...
@@ -444,7 +444,7 @@ semlock_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
failure:
if
(
handle
!=
SEM_FAILED
)
SEM_CLOSE
(
handle
);
m
p_SetError
(
NULL
,
MP_STANDARD_ERROR
);
_PyM
p_SetError
(
NULL
,
MP_STANDARD_ERROR
);
return
NULL
;
}
...
...
@@ -491,7 +491,7 @@ semlock_getvalue(SemLockObject *self)
#else
int
sval
;
if
(
SEM_GETVALUE
(
self
->
handle
,
&
sval
)
<
0
)
return
m
p_SetError
(
NULL
,
MP_STANDARD_ERROR
);
return
_PyM
p_SetError
(
NULL
,
MP_STANDARD_ERROR
);
/* some posix implementations use negative numbers to indicate
the number of waiting threads */
if
(
sval
<
0
)
...
...
@@ -507,16 +507,16 @@ semlock_iszero(SemLockObject *self)
if
(
sem_trywait
(
self
->
handle
)
<
0
)
{
if
(
errno
==
EAGAIN
)
Py_RETURN_TRUE
;
return
m
p_SetError
(
NULL
,
MP_STANDARD_ERROR
);
return
_PyM
p_SetError
(
NULL
,
MP_STANDARD_ERROR
);
}
else
{
if
(
sem_post
(
self
->
handle
)
<
0
)
return
m
p_SetError
(
NULL
,
MP_STANDARD_ERROR
);
return
_PyM
p_SetError
(
NULL
,
MP_STANDARD_ERROR
);
Py_RETURN_FALSE
;
}
#else
int
sval
;
if
(
SEM_GETVALUE
(
self
->
handle
,
&
sval
)
<
0
)
return
m
p_SetError
(
NULL
,
MP_STANDARD_ERROR
);
return
_PyM
p_SetError
(
NULL
,
MP_STANDARD_ERROR
);
return
PyBool_FromLong
((
long
)
sval
==
0
);
#endif
}
...
...
@@ -574,7 +574,7 @@ static PyMemberDef semlock_members[] = {
* Semaphore type
*/
PyTypeObject
SemLockType
=
{
PyTypeObject
_PyMp_
SemLockType
=
{
PyVarObject_HEAD_INIT
(
NULL
,
0
)
/* tp_name */
"_multiprocessing.SemLock"
,
/* tp_basicsize */
sizeof
(
SemLockObject
),
...
...
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