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
63f0db68
Commit
63f0db68
authored
Jun 04, 2006
by
Andrew MacIntyre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up function declarations to conform to PEP-7 style.
parent
6539d2d3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
22 deletions
+44
-22
Python/thread.c
Python/thread.c
+2
-1
Python/thread_nt.h
Python/thread_nt.h
+40
-20
Python/thread_os2.h
Python/thread_os2.h
+2
-1
No files found.
Python/thread.c
View file @
63f0db68
...
...
@@ -75,7 +75,8 @@ static int initialized;
static
void
PyThread__init_thread
(
void
);
/* Forward */
void
PyThread_init_thread
(
void
)
void
PyThread_init_thread
(
void
)
{
#ifdef Py_DEBUG
char
*
p
=
getenv
(
"THREADDEBUG"
);
...
...
Python/thread_nt.h
View file @
63f0db68
...
...
@@ -16,7 +16,8 @@ typedef struct NRMUTEX {
typedef
PVOID
WINAPI
interlocked_cmp_xchg_t
(
PVOID
*
dest
,
PVOID
exc
,
PVOID
comperand
)
;
/* Sorry mate, but we haven't got InterlockedCompareExchange in Win95! */
static
PVOID
WINAPI
interlocked_cmp_xchg
(
PVOID
*
dest
,
PVOID
exc
,
PVOID
comperand
)
static
PVOID
WINAPI
interlocked_cmp_xchg
(
PVOID
*
dest
,
PVOID
exc
,
PVOID
comperand
)
{
static
LONG
spinlock
=
0
;
PVOID
result
;
...
...
@@ -54,8 +55,10 @@ static PVOID WINAPI interlocked_cmp_xchg(PVOID *dest, PVOID exc, PVOID comperand
return
result
;
}
;
static
interlocked_cmp_xchg_t
*
ixchg
;
BOOL
InitializeNonRecursiveMutex
(
PNRMUTEX
mutex
)
static
interlocked_cmp_xchg_t
*
ixchg
;
BOOL
InitializeNonRecursiveMutex
(
PNRMUTEX
mutex
)
{
if
(
!
ixchg
)
{
...
...
@@ -76,14 +79,16 @@ BOOL InitializeNonRecursiveMutex(PNRMUTEX mutex)
#endif
#define InterlockedCompareExchange(dest,exchange,comperand) (ixchg((dest), (exchange), (comperand)))
VOID
DeleteNonRecursiveMutex
(
PNRMUTEX
mutex
)
VOID
DeleteNonRecursiveMutex
(
PNRMUTEX
mutex
)
{
/* No in-use check */
CloseHandle
(
mutex
->
hevent
)
;
mutex
->
hevent
=
NULL
;
/* Just in case */
}
DWORD
EnterNonRecursiveMutex
(
PNRMUTEX
mutex
,
BOOL
wait
)
DWORD
EnterNonRecursiveMutex
(
PNRMUTEX
mutex
,
BOOL
wait
)
{
/* Assume that the thread waits successfully */
DWORD
ret
;
...
...
@@ -104,7 +109,8 @@ DWORD EnterNonRecursiveMutex(PNRMUTEX mutex, BOOL wait)
return
ret
;
}
BOOL
LeaveNonRecursiveMutex
(
PNRMUTEX
mutex
)
BOOL
LeaveNonRecursiveMutex
(
PNRMUTEX
mutex
)
{
/* We don't own the mutex */
mutex
->
thread_id
=
0
;
...
...
@@ -113,7 +119,8 @@ BOOL LeaveNonRecursiveMutex(PNRMUTEX mutex)
SetEvent
(
mutex
->
hevent
)
;
/* Other threads are waiting, wake one on them up */
}
PNRMUTEX
AllocNonRecursiveMutex
(
void
)
PNRMUTEX
AllocNonRecursiveMutex
(
void
)
{
PNRMUTEX
mutex
=
(
PNRMUTEX
)
malloc
(
sizeof
(
NRMUTEX
))
;
if
(
mutex
&&
!
InitializeNonRecursiveMutex
(
mutex
))
...
...
@@ -124,7 +131,8 @@ PNRMUTEX AllocNonRecursiveMutex(void)
return
mutex
;
}
void
FreeNonRecursiveMutex
(
PNRMUTEX
mutex
)
void
FreeNonRecursiveMutex
(
PNRMUTEX
mutex
)
{
if
(
mutex
)
{
...
...
@@ -138,7 +146,8 @@ long PyThread_get_thread_ident(void);
/*
* Initialization of the C package, should not be needed.
*/
static
void
PyThread__init_thread
(
void
)
static
void
PyThread__init_thread
(
void
)
{
}
...
...
@@ -209,7 +218,8 @@ PyThread_start_new_thread(void (*func)(void *), void *arg)
* Return the thread Id instead of an handle. The Id is said to uniquely identify the
* thread in the system
*/
long
PyThread_get_thread_ident
(
void
)
long
PyThread_get_thread_ident
(
void
)
{
if
(
!
initialized
)
PyThread_init_thread
();
...
...
@@ -217,7 +227,8 @@ long PyThread_get_thread_ident(void)
return
GetCurrentThreadId
();
}
static
void
do_PyThread_exit_thread
(
int
no_cleanup
)
static
void
do_PyThread_exit_thread
(
int
no_cleanup
)
{
dprintf
((
"%ld: PyThread_exit_thread called
\n
"
,
PyThread_get_thread_ident
()));
if
(
!
initialized
)
...
...
@@ -228,18 +239,21 @@ static void do_PyThread_exit_thread(int no_cleanup)
_endthread
();
}
void
PyThread_exit_thread
(
void
)
void
PyThread_exit_thread
(
void
)
{
do_PyThread_exit_thread
(
0
);
}
void
PyThread__exit_thread
(
void
)
void
PyThread__exit_thread
(
void
)
{
do_PyThread_exit_thread
(
1
);
}
#ifndef NO_EXIT_PROG
static
void
do_PyThread_exit_prog
(
int
status
,
int
no_cleanup
)
static
void
do_PyThread_exit_prog
(
int
status
,
int
no_cleanup
)
{
dprintf
((
"PyThread_exit_prog(%d) called
\n
"
,
status
));
if
(
!
initialized
)
...
...
@@ -249,12 +263,14 @@ static void do_PyThread_exit_prog(int status, int no_cleanup)
exit
(
status
);
}
void
PyThread_exit_prog
(
int
status
)
void
PyThread_exit_prog
(
int
status
)
{
do_PyThread_exit_prog
(
status
,
0
);
}
void
PyThread__exit_prog
(
int
status
)
void
PyThread__exit_prog
(
int
status
)
{
do_PyThread_exit_prog
(
status
,
1
);
}
...
...
@@ -265,7 +281,8 @@ void PyThread__exit_prog(int status)
* I [Dag] tried to implement it with mutex but I could find a way to
* tell whether a thread already own the lock or not.
*/
PyThread_type_lock
PyThread_allocate_lock
(
void
)
PyThread_type_lock
PyThread_allocate_lock
(
void
)
{
PNRMUTEX
aLock
;
...
...
@@ -280,7 +297,8 @@ PyThread_type_lock PyThread_allocate_lock(void)
return
(
PyThread_type_lock
)
aLock
;
}
void
PyThread_free_lock
(
PyThread_type_lock
aLock
)
void
PyThread_free_lock
(
PyThread_type_lock
aLock
)
{
dprintf
((
"%ld: PyThread_free_lock(%p) called
\n
"
,
PyThread_get_thread_ident
(),
aLock
));
...
...
@@ -293,7 +311,8 @@ void PyThread_free_lock(PyThread_type_lock aLock)
* and 0 if the lock was not acquired. This means a 0 is returned
* if the lock has already been acquired by this thread!
*/
int
PyThread_acquire_lock
(
PyThread_type_lock
aLock
,
int
waitflag
)
int
PyThread_acquire_lock
(
PyThread_type_lock
aLock
,
int
waitflag
)
{
int
success
;
...
...
@@ -306,7 +325,8 @@ int PyThread_acquire_lock(PyThread_type_lock aLock, int waitflag)
return
success
;
}
void
PyThread_release_lock
(
PyThread_type_lock
aLock
)
void
PyThread_release_lock
(
PyThread_type_lock
aLock
)
{
dprintf
((
"%ld: PyThread_release_lock(%p) called
\n
"
,
PyThread_get_thread_ident
(),
aLock
));
...
...
Python/thread_os2.h
View file @
63f0db68
...
...
@@ -244,7 +244,8 @@ PyThread_acquire_lock(PyThread_type_lock aLock, int waitflag)
return
1
;
}
void
PyThread_release_lock
(
PyThread_type_lock
aLock
)
void
PyThread_release_lock
(
PyThread_type_lock
aLock
)
{
#if !defined(PYCC_GCC)
type_os2_lock
lock
=
(
type_os2_lock
)
aLock
;
...
...
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