mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
reformat for PEP-7 style conformance
This commit is contained in:
parent
6904959921
commit
c4c127b850
1 changed files with 128 additions and 117 deletions
|
@ -33,9 +33,9 @@ PyThread_start_new_thread(void (*func)(void *), void *arg)
|
||||||
|
|
||||||
aThread = _beginthread(func,NULL,65536,arg);
|
aThread = _beginthread(func,NULL,65536,arg);
|
||||||
|
|
||||||
if( aThread == -1 ) {
|
if (aThread == -1) {
|
||||||
success = -1;
|
success = -1;
|
||||||
fprintf(stderr,"aThread failed == %d",aThread);
|
fprintf(stderr, "aThread failed == %d", aThread);
|
||||||
dprintf(("_beginthread failed. return %ld\n", errno));
|
dprintf(("_beginthread failed. return %ld\n", errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ PyThread_get_thread_ident(void)
|
||||||
#if defined(PYCC_GCC)
|
#if defined(PYCC_GCC)
|
||||||
return _gettid();
|
return _gettid();
|
||||||
#else
|
#else
|
||||||
DosGetInfoBlocks(&tib,&pib);
|
DosGetInfoBlocks(&tib, &pib);
|
||||||
return tib->tib_ptib2->tib2_ultid;
|
return tib->tib_ptib2->tib2_ultid;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,8 @@ PyThread_get_thread_ident(void)
|
||||||
static void
|
static void
|
||||||
do_PyThread_exit_thread(int no_cleanup)
|
do_PyThread_exit_thread(int no_cleanup)
|
||||||
{
|
{
|
||||||
dprintf(("%ld: PyThread_exit_thread called\n", PyThread_get_thread_ident()));
|
dprintf(("%ld: PyThread_exit_thread called\n",
|
||||||
|
PyThread_get_thread_ident()));
|
||||||
if (!initialized)
|
if (!initialized)
|
||||||
if (no_cleanup)
|
if (no_cleanup)
|
||||||
_exit(0);
|
_exit(0);
|
||||||
|
@ -135,7 +136,7 @@ PyThread_allocate_lock(void)
|
||||||
free(sem);
|
free(sem);
|
||||||
sem = NULL;
|
sem = NULL;
|
||||||
}
|
}
|
||||||
return (PyThread_type_lock) sem;
|
return (PyThread_type_lock)sem;
|
||||||
#else
|
#else
|
||||||
APIRET rc;
|
APIRET rc;
|
||||||
type_os2_lock lock = (type_os2_lock)malloc(sizeof(struct os2_lock_t));
|
type_os2_lock lock = (type_os2_lock)malloc(sizeof(struct os2_lock_t));
|
||||||
|
@ -152,7 +153,7 @@ PyThread_allocate_lock(void)
|
||||||
PyThread_get_thread_ident(),
|
PyThread_get_thread_ident(),
|
||||||
lock->changed));
|
lock->changed));
|
||||||
|
|
||||||
return (PyThread_type_lock) lock;
|
return (PyThread_type_lock)lock;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +164,8 @@ PyThread_free_lock(PyThread_type_lock aLock)
|
||||||
type_os2_lock lock = (type_os2_lock)aLock;
|
type_os2_lock lock = (type_os2_lock)aLock;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dprintf(("%ld: PyThread_free_lock(%p) called\n", PyThread_get_thread_ident(),aLock));
|
dprintf(("%ld: PyThread_free_lock(%p) called\n",
|
||||||
|
PyThread_get_thread_ident(),aLock));
|
||||||
|
|
||||||
#if defined(PYCC_GCC)
|
#if defined(PYCC_GCC)
|
||||||
if (aLock) {
|
if (aLock) {
|
||||||
|
@ -192,24 +194,28 @@ PyThread_acquire_lock(PyThread_type_lock aLock, int waitflag)
|
||||||
type_os2_lock lock = (type_os2_lock)aLock;
|
type_os2_lock lock = (type_os2_lock)aLock;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dprintf(("%ld: PyThread_acquire_lock(%p, %d) called\n", PyThread_get_thread_ident(),
|
dprintf(("%ld: PyThread_acquire_lock(%p, %d) called\n",
|
||||||
aLock, waitflag));
|
PyThread_get_thread_ident(),
|
||||||
|
aLock,
|
||||||
|
waitflag));
|
||||||
|
|
||||||
#if defined(PYCC_GCC)
|
#if defined(PYCC_GCC)
|
||||||
/* always successful if the lock doesn't exist */
|
/* always successful if the lock doesn't exist */
|
||||||
if (aLock && _fmutex_request((_fmutex *)aLock, waitflag ? 0 : _FMR_NOWAIT))
|
if (aLock &&
|
||||||
|
_fmutex_request((_fmutex *)aLock, waitflag ? 0 : _FMR_NOWAIT))
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
while (!done) {
|
while (!done) {
|
||||||
/* if the lock is currently set, we have to wait for the state to change */
|
/* if the lock is currently set, we have to wait for
|
||||||
|
* the state to change
|
||||||
|
*/
|
||||||
if (lock->is_set) {
|
if (lock->is_set) {
|
||||||
if (!waitflag)
|
if (!waitflag)
|
||||||
return 0;
|
return 0;
|
||||||
DosWaitEventSem(lock->changed, SEM_INDEFINITE_WAIT);
|
DosWaitEventSem(lock->changed, SEM_INDEFINITE_WAIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* enter a critical section and try to get the semaphore. If
|
||||||
* enter a critical section and try to get the semaphore. If
|
|
||||||
* it is still locked, we will try again.
|
* it is still locked, we will try again.
|
||||||
*/
|
*/
|
||||||
if (DosEnterCritSec())
|
if (DosEnterCritSec())
|
||||||
|
@ -234,7 +240,9 @@ void PyThread_release_lock(PyThread_type_lock aLock)
|
||||||
type_os2_lock lock = (type_os2_lock)aLock;
|
type_os2_lock lock = (type_os2_lock)aLock;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dprintf(("%ld: PyThread_release_lock(%p) called\n", PyThread_get_thread_ident(),aLock));
|
dprintf(("%ld: PyThread_release_lock(%p) called\n",
|
||||||
|
PyThread_get_thread_ident(),
|
||||||
|
aLock));
|
||||||
|
|
||||||
#if defined(PYCC_GCC)
|
#if defined(PYCC_GCC)
|
||||||
if (aLock)
|
if (aLock)
|
||||||
|
@ -242,14 +250,17 @@ void PyThread_release_lock(PyThread_type_lock aLock)
|
||||||
#else
|
#else
|
||||||
if (!lock->is_set) {
|
if (!lock->is_set) {
|
||||||
dprintf(("%ld: Could not PyThread_release_lock(%p) error: %l\n",
|
dprintf(("%ld: Could not PyThread_release_lock(%p) error: %l\n",
|
||||||
PyThread_get_thread_ident(), aLock, GetLastError()));
|
PyThread_get_thread_ident(),
|
||||||
|
aLock,
|
||||||
|
GetLastError()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (DosEnterCritSec()) {
|
if (DosEnterCritSec()) {
|
||||||
dprintf(("%ld: Could not PyThread_release_lock(%p) error: %l\n",
|
dprintf(("%ld: Could not PyThread_release_lock(%p) error: %l\n",
|
||||||
PyThread_get_thread_ident(), aLock, GetLastError()));
|
PyThread_get_thread_ident(),
|
||||||
|
aLock,
|
||||||
|
GetLastError()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue