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
d7fa6b25
Kaydet (Commit)
d7fa6b25
authored
Mar 21, 2017
tarafından
Daniel Birnstiel
Kaydeden (comit)
INADA Naoki
Mar 21, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-29859: Fix error messages from return codes for pthread_* calls (GH-741)
üst
fff9a31a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
11 deletions
+16
-11
NEWS
Misc/NEWS
+3
-0
thread_pthread.h
Python/thread_pthread.h
+13
-11
No files found.
Misc/NEWS
Dosyayı görüntüle @
d7fa6b25
...
...
@@ -10,6 +10,9 @@ What's New in Python 3.7.0 alpha 1?
Core and Builtins
-----------------
- bpo-29859: Show correct error messages when any of the pthread_* calls in
thread_pthread.h fails.
- bpo-29849: Fix a memory leak when an ImportError is raised during from import.
- bpo-28856: Fix an oversight that %b format for bytes should support objects
...
...
Python/thread_pthread.h
Dosyayı görüntüle @
d7fa6b25
...
...
@@ -143,6 +143,8 @@ typedef struct {
}
pthread_lock
;
#define CHECK_STATUS(name) if (status != 0) { perror(name); error = 1; }
#define CHECK_STATUS_PTHREAD(name) if (status != 0) { fprintf(stderr, \
"%s: %s\n", name, strerror(status)); error = 1; }
/*
* Initialization.
...
...
@@ -417,7 +419,7 @@ PyThread_allocate_lock(void)
status
=
pthread_mutex_init
(
&
lock
->
mut
,
pthread_mutexattr_default
);
CHECK_STATUS
(
"pthread_mutex_init"
);
CHECK_STATUS
_PTHREAD
(
"pthread_mutex_init"
);
/* Mark the pthread mutex underlying a Python mutex as
pure happens-before. We can't simply mark the
Python-level mutex as a mutex because it can be
...
...
@@ -427,7 +429,7 @@ PyThread_allocate_lock(void)
status
=
pthread_cond_init
(
&
lock
->
lock_released
,
pthread_condattr_default
);
CHECK_STATUS
(
"pthread_cond_init"
);
CHECK_STATUS
_PTHREAD
(
"pthread_cond_init"
);
if
(
error
)
{
PyMem_RawFree
((
void
*
)
lock
);
...
...
@@ -452,10 +454,10 @@ PyThread_free_lock(PyThread_type_lock lock)
* and must have the cond destroyed first.
*/
status
=
pthread_cond_destroy
(
&
thelock
->
lock_released
);
CHECK_STATUS
(
"pthread_cond_destroy"
);
CHECK_STATUS
_PTHREAD
(
"pthread_cond_destroy"
);
status
=
pthread_mutex_destroy
(
&
thelock
->
mut
);
CHECK_STATUS
(
"pthread_mutex_destroy"
);
CHECK_STATUS
_PTHREAD
(
"pthread_mutex_destroy"
);
PyMem_RawFree
((
void
*
)
thelock
);
}
...
...
@@ -472,7 +474,7 @@ PyThread_acquire_lock_timed(PyThread_type_lock lock, PY_TIMEOUT_T microseconds,
lock
,
microseconds
,
intr_flag
));
status
=
pthread_mutex_lock
(
&
thelock
->
mut
);
CHECK_STATUS
(
"pthread_mutex_lock[1]"
);
CHECK_STATUS
_PTHREAD
(
"pthread_mutex_lock[1]"
);
if
(
thelock
->
locked
==
0
)
{
success
=
PY_LOCK_ACQUIRED
;
...
...
@@ -494,13 +496,13 @@ PyThread_acquire_lock_timed(PyThread_type_lock lock, PY_TIMEOUT_T microseconds,
&
thelock
->
mut
,
&
ts
);
if
(
status
==
ETIMEDOUT
)
break
;
CHECK_STATUS
(
"pthread_cond_timed_wait"
);
CHECK_STATUS
_PTHREAD
(
"pthread_cond_timed_wait"
);
}
else
{
status
=
pthread_cond_wait
(
&
thelock
->
lock_released
,
&
thelock
->
mut
);
CHECK_STATUS
(
"pthread_cond_wait"
);
CHECK_STATUS
_PTHREAD
(
"pthread_cond_wait"
);
}
if
(
intr_flag
&&
status
==
0
&&
thelock
->
locked
)
{
...
...
@@ -518,7 +520,7 @@ PyThread_acquire_lock_timed(PyThread_type_lock lock, PY_TIMEOUT_T microseconds,
}
if
(
success
==
PY_LOCK_ACQUIRED
)
thelock
->
locked
=
1
;
status
=
pthread_mutex_unlock
(
&
thelock
->
mut
);
CHECK_STATUS
(
"pthread_mutex_unlock[1]"
);
CHECK_STATUS
_PTHREAD
(
"pthread_mutex_unlock[1]"
);
if
(
error
)
success
=
PY_LOCK_FAILURE
;
dprintf
((
"PyThread_acquire_lock_timed(%p, %lld, %d) -> %d
\n
"
,
...
...
@@ -536,16 +538,16 @@ PyThread_release_lock(PyThread_type_lock lock)
dprintf
((
"PyThread_release_lock(%p) called
\n
"
,
lock
));
status
=
pthread_mutex_lock
(
&
thelock
->
mut
);
CHECK_STATUS
(
"pthread_mutex_lock[3]"
);
CHECK_STATUS
_PTHREAD
(
"pthread_mutex_lock[3]"
);
thelock
->
locked
=
0
;
/* wake up someone (anyone, if any) waiting on the lock */
status
=
pthread_cond_signal
(
&
thelock
->
lock_released
);
CHECK_STATUS
(
"pthread_cond_signal"
);
CHECK_STATUS
_PTHREAD
(
"pthread_cond_signal"
);
status
=
pthread_mutex_unlock
(
&
thelock
->
mut
);
CHECK_STATUS
(
"pthread_mutex_unlock[3]"
);
CHECK_STATUS
_PTHREAD
(
"pthread_mutex_unlock[3]"
);
}
#endif
/* USE_SEMAPHORES */
...
...
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