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
d6353e2c
Kaydet (Commit)
d6353e2c
authored
May 13, 1997
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Support for various versions of the pthread draft.
üst
5f15b96c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
12 deletions
+64
-12
thread_pthread.h
Python/thread_pthread.h
+64
-12
No files found.
Python/thread_pthread.h
Dosyayı görüntüle @
d6353e2c
...
...
@@ -34,25 +34,57 @@ PERFORMANCE OF THIS SOFTWARE.
#include <stdlib.h>
#include <pthread.h>
#ifdef _AIX
#ifndef SCHED_BG_NP
/* try to determine what version of the Pthread Standard is installed.
* this is important, since all sorts of parameter types changed from
* draft to draft and there are several (incompatible) drafts in
* common use. these macros are a start, at least.
* 12 May 1997 -- david arnold <davida@pobox.com>
*/
#if defined(__ultrix) && defined(__mips) && defined(_DECTHREADS_)
/* _DECTHREADS_ is defined in cma.h which is included by pthread.h */
# define PY_PTHREAD_D4
#elif defined(__osf__) && defined (__alpha)
/* _DECTHREADS_ is defined in cma.h which is included by pthread.h */
# if !defined(_PTHREAD_ENV_ALPHA) || defined(_PTHREAD_USE_D4) || defined(PTHREAD_USE_D4)
# define PY_PTHREAD_D4
# else
# define PY_PTHREAD_STD
# endif
#elif defined(_AIX)
/* SCHED_BG_NP is defined if using AIX DCE pthreads
* but it is unsupported by AIX 4 pthreads. Default
* attributes for AIX 4 pthreads equal to NULL. For
* AIX DCE pthreads they should be left unchanged.
*/
#define pthread_attr_default NULL
#define pthread_mutexattr_default NULL
#define pthread_condattr_default NULL
# if !defined(SCHED_BG_NP)
# define PY_PTHREAD_STD
# else
# define PY_PTHREAD_D7
# endif
#elif defined(__unix) && defined(__sparc)
# define PY_PTHREAD_STD
#endif
#else
#define pthread_attr_default ((pthread_attr_t *)0)
#define pthread_mutexattr_default ((pthread_mutexattr_t *)0)
#define pthread_condattr_default ((pthread_condattr_t *)0)
/* set default attribute object for different versions */
#if defined(PY_PTHREAD_D4) || defined(PY_PTHREAD_D7)
# define pthread_attr_default pthread_attr_default
# define pthread_mutexattr_default pthread_mutexattr_default
# define pthread_condattr_default pthread_condattr_default
#elif defined(PY_PTHREAD_STD)
# define pthread_attr_default ((pthread_attr_t *)NULL)
# define pthread_mutexattr_default ((pthread_mutexattr_t *)NULL)
# define pthread_condattr_default ((pthread_condattr_t *)NULL)
#endif
/* A pthread mutex isn't sufficient to model the Python lock type
* because, according to Draft 5 of the docs (P1003.4a/D5), both of the
* following are undefined:
...
...
@@ -96,10 +128,30 @@ int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
dprintf
((
"start_new_thread called
\n
"
));
if
(
!
initialized
)
init_thread
();
success
=
pthread_create
(
&
th
,
pthread_attr_default
,
(
void
*
(
*
)
_P
((
void
*
)))
func
,
arg
);
if
(
success
>=
0
)
success
=
pthread_create
(
&
th
,
#if defined(PY_PTHREAD_D4)
pthread_attr_default
,
(
pthread_startroutine_t
)
func
,
(
pthread_addr_t
)
arg
#elif defined(PY_PTHREAD_D7)
pthread_attr_default
,
func
,
arg
#elif defined(PY_PTHREAD_STD)
(
pthread_attr_t
*
)
NULL
,
(
void
*
(
*
)
_P
((
void
*
)))
func
,
(
void
*
)
arg
#endif
);
if
(
success
>=
0
)
{
#if defined(PY_THREAD_D4) || defined(PY_PTHREAD_D7)
pthread_detach
(
&
th
);
#elif defined(PY_PTHREAD_STD)
pthread_detach
(
th
);
#endif
}
return
success
<
0
?
0
:
1
;
}
...
...
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