Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
d6353e2c
Commit
d6353e2c
authored
May 13, 1997
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support for various versions of the pthread draft.
parent
5f15b96c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
12 deletions
+64
-12
Python/thread_pthread.h
Python/thread_pthread.h
+64
-12
No files found.
Python/thread_pthread.h
View file @
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