Trent Mick <trentm@activestate.com>:

The common technique for printing out a pointer has been to cast to a long
and use the "%lx" printf modifier. This is incorrect on Win64 where casting
to a long truncates the pointer. The "%p" formatter should be used instead.

The problem as stated by Tim:
> Unfortunately, the C committee refused to define what %p conversion "looks
> like" -- they explicitly allowed it to be implementation-defined. Older
> versions of Microsoft C even stuck a colon in the middle of the address (in
> the days of segment+offset addressing)!

The result is that the hex value of a pointer will maybe/maybe not have a 0x
prepended to it.


Notes on the patch:

There are two main classes of changes:
- in the various repr() functions that print out pointers
- debugging printf's in the various thread_*.h files (these are why the
patch is large)


Closes SourceForge patch #100505.
This commit is contained in:
Fred Drake 2000-06-30 15:01:00 +00:00
parent d49e5b4667
commit a44d353e2b
22 changed files with 153 additions and 153 deletions

View file

@ -1705,7 +1705,7 @@ Tktt_Repr(self)
TkttObject *v = (TkttObject *)self; TkttObject *v = (TkttObject *)self;
char buf[100]; char buf[100];
sprintf(buf, "<tktimertoken at 0x%lx%s>", (long)v, sprintf(buf, "<tktimertoken at %p%s>", v,
v->func == NULL ? ", handler deleted" : ""); v->func == NULL ? ", handler deleted" : "");
return PyString_FromString(buf); return PyString_FromString(buf);
} }

View file

@ -435,8 +435,8 @@ generic_repr(g)
genericobject *g; genericobject *g;
{ {
char buf[100]; char buf[100];
sprintf(buf, "<FORMS_object at %lx, objclass=%d>", sprintf(buf, "<FORMS_object at %p, objclass=%d>",
(long)g, g->ob_generic->objclass); g, g->ob_generic->objclass);
return PyString_FromString(buf); return PyString_FromString(buf);
} }
@ -1906,8 +1906,8 @@ form_repr(f)
formobject *f; formobject *f;
{ {
char buf[100]; char buf[100];
sprintf(buf, "<FORMS_form at %lx, window=%ld>", sprintf(buf, "<FORMS_form at %p, window=%ld>",
(long)f, f->ob_form->window); f, f->ob_form->window);
return PyString_FromString(buf); return PyString_FromString(buf);
} }

View file

@ -262,7 +262,7 @@ mpz_format(objp, base, withname)
#ifdef MPZ_DEBUG #ifdef MPZ_DEBUG
fprintf(stderr, fprintf(stderr,
"mpz_format: cp (str end) 0x%x, begin 0x%x, diff %d, i %d\n", "mpz_format: cp (str end) %p, begin %p, diff %d, i %d\n",
cp, PyString_AS_STRING(strobjp), cp, PyString_AS_STRING(strobjp),
cp - PyString_AS_STRING(strobjp), i); cp - PyString_AS_STRING(strobjp), i);
#endif /* def MPZ_DEBUG */ #endif /* def MPZ_DEBUG */
@ -1765,7 +1765,7 @@ void *mp_allocate( alloc_size )
Py_FatalError("mp_allocate failure"); Py_FatalError("mp_allocate failure");
#ifdef MPZ_DEBUG #ifdef MPZ_DEBUG
fprintf(stderr, "mp_allocate : address 0x%08x\n", res); fprintf(stderr, "mp_allocate : address %08p\n", res);
#endif /* def MPZ_DEBUG */ #endif /* def MPZ_DEBUG */
MP_SET_TEST(res,alloc_size); MP_SET_TEST(res,alloc_size);
@ -1782,7 +1782,7 @@ void *mp_reallocate( ptr, old_size, new_size )
void *res; void *res;
#ifdef MPZ_DEBUG #ifdef MPZ_DEBUG
fprintf(stderr, "mp_reallocate: old address 0x%08x, old size %ld\n", fprintf(stderr, "mp_reallocate: old address %08p, old size %ld\n",
ptr, old_size); ptr, old_size);
#endif /* def MPZ_DEBUG */ #endif /* def MPZ_DEBUG */
@ -1792,7 +1792,7 @@ void *mp_reallocate( ptr, old_size, new_size )
Py_FatalError("mp_reallocate failure"); Py_FatalError("mp_reallocate failure");
#ifdef MPZ_DEBUG #ifdef MPZ_DEBUG
fprintf(stderr, "mp_reallocate: new address 0x%08x, new size %ld\n", fprintf(stderr, "mp_reallocate: new address %08p, new size %ld\n",
res, new_size); res, new_size);
#endif /* def MPZ_DEBUG */ #endif /* def MPZ_DEBUG */
@ -1808,7 +1808,7 @@ void mp_free( ptr, size )
{ {
#ifdef MPZ_DEBUG #ifdef MPZ_DEBUG
fprintf(stderr, "mp_free : old address 0x%08x, old size %ld\n", fprintf(stderr, "mp_free : old address %08p, old size %ld\n",
ptr, size); ptr, size);
#endif /* def MPZ_DEBUG */ #endif /* def MPZ_DEBUG */

View file

@ -241,20 +241,20 @@ buffer_repr(self)
if ( self->b_base == NULL ) if ( self->b_base == NULL )
{ {
sprintf(buf, "<%s buffer ptr %lx, size %d at %lx>", sprintf(buf, "<%s buffer ptr %p, size %d at %p>",
status, status,
(long)self->b_ptr, self->b_ptr,
self->b_size, self->b_size,
(long)self); self);
} }
else else
{ {
sprintf(buf, "<%s buffer for %lx, ptr %lx, size %d at %lx>", sprintf(buf, "<%s buffer for %p, ptr %p, size %d at %p>",
status, status,
(long)self->b_base, self->b_base,
(long)self->b_ptr, self->b_ptr,
self->b_size, self->b_size,
(long)self); self);
} }
return PyString_FromString(buf); return PyString_FromString(buf);

View file

@ -353,11 +353,11 @@ class_repr(op)
else else
name = PyString_AsString(op->cl_name); name = PyString_AsString(op->cl_name);
if (mod == NULL || !PyString_Check(mod)) if (mod == NULL || !PyString_Check(mod))
sprintf(buf, "<class ?.%.100s at %lx>", name, (long)op); sprintf(buf, "<class ?.%.100s at %p>", name, op);
else else
sprintf(buf, "<class %.50s.%.50s at %lx>", sprintf(buf, "<class %.50s.%.50s at %p>",
PyString_AsString(mod), PyString_AsString(mod),
name, (long)op); name, op);
return PyString_FromString(buf); return PyString_FromString(buf);
} }
@ -805,12 +805,12 @@ instance_repr(inst)
cname = "?"; cname = "?";
PyErr_Clear(); PyErr_Clear();
if (mod == NULL || !PyString_Check(mod)) if (mod == NULL || !PyString_Check(mod))
sprintf(buf, "<?.%.100s instance at %lx>", sprintf(buf, "<?.%.100s instance at %p>",
cname, (long)inst); cname, inst);
else else
sprintf(buf, "<%.50s.%.50s instance at %lx>", sprintf(buf, "<%.50s.%.50s instance at %p>",
PyString_AsString(mod), PyString_AsString(mod),
cname, (long)inst); cname, inst);
return PyString_FromString(buf); return PyString_FromString(buf);
} }
res = PyEval_CallObject(func, (PyObject *)NULL); res = PyEval_CallObject(func, (PyObject *)NULL);
@ -1704,8 +1704,8 @@ instancemethod_repr(a)
icname = PyString_AsString(iclassname); icname = PyString_AsString(iclassname);
else else
icname = "?"; icname = "?";
sprintf(buf, "<method %.60s.%.60s of %.60s instance at %lx>", sprintf(buf, "<method %.60s.%.60s of %.60s instance at %p>",
fcname, fname, icname, (long)self); fcname, fname, icname, self);
} }
Py_XDECREF(funcname); Py_XDECREF(funcname);
return PyString_FromString(buf); return PyString_FromString(buf);

View file

@ -240,11 +240,11 @@ file_repr(f)
PyFileObject *f; PyFileObject *f;
{ {
char buf[300]; char buf[300];
sprintf(buf, "<%s file '%.256s', mode '%.10s' at %lx>", sprintf(buf, "<%s file '%.256s', mode '%.10s' at %p>",
f->f_fp == NULL ? "closed" : "open", f->f_fp == NULL ? "closed" : "open",
PyString_AsString(f->f_name), PyString_AsString(f->f_name),
PyString_AsString(f->f_mode), PyString_AsString(f->f_mode),
(long)f); f);
return PyString_FromString(buf); return PyString_FromString(buf);
} }

View file

@ -806,8 +806,8 @@ PyFloat_Fini()
char buf[100]; char buf[100];
PyFloat_AsString(buf, p); PyFloat_AsString(buf, p);
fprintf(stderr, fprintf(stderr,
"# <float at %lx, refcnt=%d, val=%s>\n", "# <float at %p, refcnt=%d, val=%s>\n",
(long)p, p->ob_refcnt, buf); p, p->ob_refcnt, buf);
} }
} }
list = list->next; list = list->next;

View file

@ -202,11 +202,11 @@ func_repr(op)
{ {
char buf[140]; char buf[140];
if (op->func_name == Py_None) if (op->func_name == Py_None)
sprintf(buf, "<anonymous function at %lx>", (long)op); sprintf(buf, "<anonymous function at %p>", op);
else else
sprintf(buf, "<function %.100s at %lx>", sprintf(buf, "<function %.100s at %p>",
PyString_AsString(op->func_name), PyString_AsString(op->func_name),
(long)op); op);
return PyString_FromString(buf); return PyString_FromString(buf);
} }

View file

@ -957,8 +957,8 @@ PyInt_Fini()
i++, p++) { i++, p++) {
if (PyInt_Check(p) && p->ob_refcnt != 0) if (PyInt_Check(p) && p->ob_refcnt != 0)
fprintf(stderr, fprintf(stderr,
"# <int at %lx, refcnt=%d, val=%ld>\n", "# <int at %p, refcnt=%d, val=%ld>\n",
(long)p, p->ob_refcnt, p->ob_ival); p, p->ob_refcnt, p->ob_ival);
} }
list = list->next; list = list->next;
} }

View file

@ -148,9 +148,9 @@ meth_repr(m)
sprintf(buf, "<built-in function %.80s>", m->m_ml->ml_name); sprintf(buf, "<built-in function %.80s>", m->m_ml->ml_name);
else else
sprintf(buf, sprintf(buf,
"<built-in method %.80s of %.80s object at %lx>", "<built-in method %.80s of %.80s object at %p>",
m->m_ml->ml_name, m->m_self->ob_type->tp_name, m->m_ml->ml_name, m->m_self->ob_type->tp_name,
(long)m->m_self); m->m_self);
return PyString_FromString(buf); return PyString_FromString(buf);
} }

View file

@ -229,12 +229,12 @@ PyObject_Print(op, fp, flags)
} }
else { else {
if (op->ob_refcnt <= 0) if (op->ob_refcnt <= 0)
fprintf(fp, "<refcnt %u at %lx>", fprintf(fp, "<refcnt %u at %p>",
op->ob_refcnt, (long)op); op->ob_refcnt, op);
else if (op->ob_type->tp_print == NULL) { else if (op->ob_type->tp_print == NULL) {
if (op->ob_type->tp_repr == NULL) { if (op->ob_type->tp_repr == NULL) {
fprintf(fp, "<%s object at %lx>", fprintf(fp, "<%s object at %p>",
op->ob_type->tp_name, (long)op); op->ob_type->tp_name, op);
} }
else { else {
PyObject *s; PyObject *s;
@ -280,8 +280,8 @@ PyObject_Repr(v)
return PyString_FromString("<NULL>"); return PyString_FromString("<NULL>");
else if (v->ob_type->tp_repr == NULL) { else if (v->ob_type->tp_repr == NULL) {
char buf[120]; char buf[120];
sprintf(buf, "<%.80s object at %lx>", sprintf(buf, "<%.80s object at %p>",
v->ob_type->tp_name, (long)v); v->ob_type->tp_name, v);
return PyString_FromString(buf); return PyString_FromString(buf);
} }
else { else {

View file

@ -262,7 +262,7 @@ PyThread_type_lock PyThread_allocate_lock( void )
return (PyThread_type_lock)NULL; return (PyThread_type_lock)NULL;
} }
dprintf(("PyThread_allocate_lock() -> %lx\n", (long)lock)); dprintf(("PyThread_allocate_lock() -> %p\n", lock));
return (PyThread_type_lock) lock; return (PyThread_type_lock) lock;
} }
@ -270,7 +270,7 @@ void PyThread_free_lock( PyThread_type_lock lock )
{ {
status_t retval; status_t retval;
dprintf(("PyThread_free_lock(%lx) called\n", (long)lock)); dprintf(("PyThread_free_lock(%p) called\n", lock));
retval = benaphore_destroy( (benaphore_t *)lock ); retval = benaphore_destroy( (benaphore_t *)lock );
if( retval != EOK ) { if( retval != EOK ) {
@ -284,7 +284,7 @@ int PyThread_acquire_lock( PyThread_type_lock lock, int waitflag )
int success; int success;
status_t retval; status_t retval;
dprintf(("PyThread_acquire_lock(%lx, %d) called\n", (long)lock, waitflag)); dprintf(("PyThread_acquire_lock(%p, %d) called\n", lock, waitflag));
if( waitflag ) { if( waitflag ) {
retval = benaphore_lock( (benaphore_t *)lock ); retval = benaphore_lock( (benaphore_t *)lock );
@ -300,7 +300,7 @@ int PyThread_acquire_lock( PyThread_type_lock lock, int waitflag )
/* TODO: that's bad, raise an exception */ /* TODO: that's bad, raise an exception */
} }
dprintf(("PyThread_acquire_lock(%lx, %d) -> %d\n", (long)lock, waitflag, success)); dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success));
return success; return success;
} }
@ -308,7 +308,7 @@ void PyThread_release_lock( PyThread_type_lock lock )
{ {
status_t retval; status_t retval;
dprintf(("PyThread_release_lock(%lx) called\n", (long)lock)); dprintf(("PyThread_release_lock(%p) called\n", lock));
retval = benaphore_unlock( (benaphore_t *)lock ); retval = benaphore_unlock( (benaphore_t *)lock );
if( retval != EOK ) { if( retval != EOK ) {
@ -336,7 +336,7 @@ PyThread_type_sema PyThread_allocate_sema( int value )
return 0; return 0;
} }
dprintf(("PyThread_allocate_sema() -> %lx\n", (long) sema)); dprintf(("PyThread_allocate_sema() -> %p\n", sema));
return (PyThread_type_sema) sema; return (PyThread_type_sema) sema;
} }
@ -344,7 +344,7 @@ void PyThread_free_sema( PyThread_type_sema sema )
{ {
status_t retval; status_t retval;
dprintf(("PyThread_free_sema(%lx) called\n", (long) sema)); dprintf(("PyThread_free_sema(%p) called\n", sema));
retval = delete_sem( (sem_id)sema ); retval = delete_sem( (sem_id)sema );
if( retval != B_NO_ERROR ) { if( retval != B_NO_ERROR ) {
@ -357,7 +357,7 @@ int PyThread_down_sema( PyThread_type_sema sema, int waitflag )
{ {
status_t retval; status_t retval;
dprintf(("PyThread_down_sema(%lx, %d) called\n", (long) sema, waitflag)); dprintf(("PyThread_down_sema(%p, %d) called\n", sema, waitflag));
if( waitflag ) { if( waitflag ) {
retval = acquire_sem( (sem_id)sema ); retval = acquire_sem( (sem_id)sema );
@ -370,7 +370,7 @@ int PyThread_down_sema( PyThread_type_sema sema, int waitflag )
return 0; return 0;
} }
dprintf(("PyThread_down_sema(%lx) return\n", (long) sema)); dprintf(("PyThread_down_sema(%p) return\n", sema));
return -1; return -1;
} }
@ -378,7 +378,7 @@ void PyThread_up_sema( PyThread_type_sema sema )
{ {
status_t retval; status_t retval;
dprintf(("PyThread_up_sema(%lx)\n", (long) sema)); dprintf(("PyThread_up_sema(%p)\n", sema));
retval = release_sem( (sem_id)sema ); retval = release_sem( (sem_id)sema );
if( retval != B_NO_ERROR ) { if( retval != B_NO_ERROR ) {

View file

@ -129,13 +129,13 @@ PyThread_type_lock PyThread_allocate_lock _P0()
free((void *) lock); free((void *) lock);
lock = 0; lock = 0;
} }
dprintf(("PyThread_allocate_lock() -> %lx\n", (long)lock)); dprintf(("PyThread_allocate_lock() -> %p\n", lock));
return (PyThread_type_lock) lock; return (PyThread_type_lock) lock;
} }
void PyThread_free_lock _P1(lock, PyThread_type_lock lock) void PyThread_free_lock _P1(lock, PyThread_type_lock lock)
{ {
dprintf(("PyThread_free_lock(%lx) called\n", (long)lock)); dprintf(("PyThread_free_lock(%p) called\n", lock));
mutex_free(lock); mutex_free(lock);
} }
@ -143,20 +143,20 @@ int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitf
{ {
int success = FALSE; int success = FALSE;
dprintf(("PyThread_acquire_lock(%lx, %d) called\n", (long)lock, waitflag)); dprintf(("PyThread_acquire_lock(%p, %d) called\n", lock, waitflag));
if (waitflag) { /* blocking */ if (waitflag) { /* blocking */
mutex_lock(lock); mutex_lock(lock);
success = TRUE; success = TRUE;
} else { /* non blocking */ } else { /* non blocking */
success = mutex_try_lock(lock); success = mutex_try_lock(lock);
} }
dprintf(("PyThread_acquire_lock(%lx, %d) -> %d\n", (long)lock, waitflag, success)); dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success));
return success; return success;
} }
void PyThread_release_lock _P1(lock, PyThread_type_lock lock) void PyThread_release_lock _P1(lock, PyThread_type_lock lock)
{ {
dprintf(("PyThread_release_lock(%lx) called\n", (long)lock)); dprintf(("PyThread_release_lock(%p) called\n", lock));
mutex_unlock((mutex_t )lock); mutex_unlock((mutex_t )lock);
} }
@ -181,23 +181,23 @@ PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
if (!initialized) if (!initialized)
PyThread_init_thread(); PyThread_init_thread();
dprintf(("PyThread_allocate_sema() -> %lx\n", (long) sema)); dprintf(("PyThread_allocate_sema() -> %p\n", sema));
return (PyThread_type_sema) sema; return (PyThread_type_sema) sema;
} }
void PyThread_free_sema _P1(sema, PyThread_type_sema sema) void PyThread_free_sema _P1(sema, PyThread_type_sema sema)
{ {
dprintf(("PyThread_free_sema(%lx) called\n", (long) sema)); dprintf(("PyThread_free_sema(%p) called\n", sema));
} }
int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag) int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag)
{ {
dprintf(("PyThread_down_sema(%lx, %d) called\n", (long) sema, waitflag)); dprintf(("PyThread_down_sema(%p, %d) called\n", sema, waitflag));
dprintf(("PyThread_down_sema(%lx) return\n", (long) sema)); dprintf(("PyThread_down_sema(%p) return\n", sema));
return -1; return -1;
} }
void PyThread_up_sema _P1(sema, PyThread_type_sema sema) void PyThread_up_sema _P1(sema, PyThread_type_sema sema)
{ {
dprintf(("PyThread_up_sema(%lx)\n", (long) sema)); dprintf(("PyThread_up_sema(%p)\n", sema));
} }

View file

@ -108,27 +108,27 @@ PyThread_type_lock PyThread_allocate_lock _P0()
if (!initialized) if (!initialized)
PyThread_init_thread(); PyThread_init_thread();
dprintf(("PyThread_allocate_lock() -> %lx\n", (long)lock)); dprintf(("PyThread_allocate_lock() -> %p\n", lock));
return (PyThread_type_lock) lock; return (PyThread_type_lock) lock;
} }
void PyThread_free_lock _P1(lock, PyThread_type_lock lock) void PyThread_free_lock _P1(lock, PyThread_type_lock lock)
{ {
dprintf(("PyThread_free_lock(%lx) called\n", (long)lock)); dprintf(("PyThread_free_lock(%p) called\n", lock));
} }
int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitflag) int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitflag)
{ {
int success; int success;
dprintf(("PyThread_acquire_lock(%lx, %d) called\n", (long)lock, waitflag)); dprintf(("PyThread_acquire_lock(%p, %d) called\n", lock, waitflag));
dprintf(("PyThread_acquire_lock(%lx, %d) -> %d\n", (long)lock, waitflag, success)); dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success));
return success; return success;
} }
void PyThread_release_lock _P1(lock, PyThread_type_lock lock) void PyThread_release_lock _P1(lock, PyThread_type_lock lock)
{ {
dprintf(("PyThread_release_lock(%lx) called\n", (long)lock)); dprintf(("PyThread_release_lock(%p) called\n", lock));
} }
/* /*
@ -140,23 +140,23 @@ PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
if (!initialized) if (!initialized)
PyThread_init_thread(); PyThread_init_thread();
dprintf(("PyThread_allocate_sema() -> %lx\n", (long) sema)); dprintf(("PyThread_allocate_sema() -> %p\n", sema));
return (PyThread_type_sema) sema; return (PyThread_type_sema) sema;
} }
void PyThread_free_sema _P1(sema, PyThread_type_sema sema) void PyThread_free_sema _P1(sema, PyThread_type_sema sema)
{ {
dprintf(("PyThread_free_sema(%lx) called\n", (long) sema)); dprintf(("PyThread_free_sema(%p) called\n", sema));
} }
int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag) int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag)
{ {
dprintf(("PyThread_down_sema(%lx, %d) called\n", (long) sema, waitflag)); dprintf(("PyThread_down_sema(%p, %d) called\n", sema, waitflag));
dprintf(("PyThread_down_sema(%lx) return\n", (long) sema)); dprintf(("PyThread_down_sema(%p) return\n", sema));
return -1; return -1;
} }
void PyThread_up_sema _P1(sema, PyThread_type_sema sema) void PyThread_up_sema _P1(sema, PyThread_type_sema sema)
{ {
dprintf(("PyThread_up_sema(%lx)\n", (long) sema)); dprintf(("PyThread_up_sema(%p)\n", sema));
} }

View file

@ -137,13 +137,13 @@ PyThread_type_lock PyThread_allocate_lock _P0()
lock->lock_locked = 0; lock->lock_locked = 0;
(void) mon_create(&lock->lock_monitor); (void) mon_create(&lock->lock_monitor);
(void) cv_create(&lock->lock_condvar, lock->lock_monitor); (void) cv_create(&lock->lock_condvar, lock->lock_monitor);
dprintf(("PyThread_allocate_lock() -> %lx\n", (long)lock)); dprintf(("PyThread_allocate_lock() -> %p\n", lock));
return (PyThread_type_lock) lock; return (PyThread_type_lock) lock;
} }
void PyThread_free_lock _P1(lock, PyThread_type_lock lock) void PyThread_free_lock _P1(lock, PyThread_type_lock lock)
{ {
dprintf(("PyThread_free_lock(%lx) called\n", (long)lock)); dprintf(("PyThread_free_lock(%p) called\n", lock));
mon_destroy(((struct lock *) lock)->lock_monitor); mon_destroy(((struct lock *) lock)->lock_monitor);
free((char *) lock); free((char *) lock);
} }
@ -152,7 +152,7 @@ int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitf
{ {
int success; int success;
dprintf(("PyThread_acquire_lock(%lx, %d) called\n", (long)lock, waitflag)); dprintf(("PyThread_acquire_lock(%p, %d) called\n", lock, waitflag));
success = 0; success = 0;
(void) mon_enter(((struct lock *) lock)->lock_monitor); (void) mon_enter(((struct lock *) lock)->lock_monitor);
@ -165,13 +165,13 @@ int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitf
} }
cv_broadcast(((struct lock *) lock)->lock_condvar); cv_broadcast(((struct lock *) lock)->lock_condvar);
mon_exit(((struct lock *) lock)->lock_monitor); mon_exit(((struct lock *) lock)->lock_monitor);
dprintf(("PyThread_acquire_lock(%lx, %d) -> %d\n", (long)lock, waitflag, success)); dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success));
return success; return success;
} }
void PyThread_release_lock _P1(lock, PyThread_type_lock lock) void PyThread_release_lock _P1(lock, PyThread_type_lock lock)
{ {
dprintf(("PyThread_release_lock(%lx) called\n", (long)lock)); dprintf(("PyThread_release_lock(%p) called\n", lock));
(void) mon_enter(((struct lock *) lock)->lock_monitor); (void) mon_enter(((struct lock *) lock)->lock_monitor);
((struct lock *) lock)->lock_locked = 0; ((struct lock *) lock)->lock_locked = 0;
cv_broadcast(((struct lock *) lock)->lock_condvar); cv_broadcast(((struct lock *) lock)->lock_condvar);
@ -188,23 +188,23 @@ PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
if (!initialized) if (!initialized)
PyThread_init_thread(); PyThread_init_thread();
dprintf(("PyThread_allocate_sema() -> %lx\n", (long) sema)); dprintf(("PyThread_allocate_sema() -> %p\n", sema));
return (PyThread_type_sema) sema; return (PyThread_type_sema) sema;
} }
void PyThread_free_sema _P1(sema, PyThread_type_sema sema) void PyThread_free_sema _P1(sema, PyThread_type_sema sema)
{ {
dprintf(("PyThread_free_sema(%lx) called\n", (long) sema)); dprintf(("PyThread_free_sema(%p) called\n", sema));
} }
int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag) int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag)
{ {
dprintf(("PyThread_down_sema(%lx, %d) called\n", (long) sema, waitflag)); dprintf(("PyThread_down_sema(%p, %d) called\n", sema, waitflag));
dprintf(("PyThread_down_sema(%lx) return\n", (long) sema)); dprintf(("PyThread_down_sema(%p) return\n", sema));
return -1; return -1;
} }
void PyThread_up_sema _P1(sema, PyThread_type_sema sema) void PyThread_up_sema _P1(sema, PyThread_type_sema sema)
{ {
dprintf(("PyThread_up_sema(%lx)\n", (long) sema)); dprintf(("PyThread_up_sema(%p)\n", sema));
} }

View file

@ -273,14 +273,14 @@ PyThread_type_lock PyThread_allocate_lock(void)
aLock = AllocNonRecursiveMutex() ; aLock = AllocNonRecursiveMutex() ;
dprintf(("%ld: PyThread_allocate_lock() -> %lx\n", PyThread_get_thread_ident(), (long)aLock)); dprintf(("%ld: PyThread_allocate_lock() -> %p\n", PyThread_get_thread_ident(), aLock));
return (PyThread_type_lock) aLock; 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(%lx) called\n", PyThread_get_thread_ident(),(long)aLock)); dprintf(("%ld: PyThread_free_lock(%p) called\n", PyThread_get_thread_ident(),aLock));
FreeNonRecursiveMutex(aLock) ; FreeNonRecursiveMutex(aLock) ;
} }
@ -295,21 +295,21 @@ int PyThread_acquire_lock(PyThread_type_lock aLock, int waitflag)
{ {
int success ; int success ;
dprintf(("%ld: PyThread_acquire_lock(%lx, %d) called\n", PyThread_get_thread_ident(),(long)aLock, waitflag)); dprintf(("%ld: PyThread_acquire_lock(%p, %d) called\n", PyThread_get_thread_ident(),aLock, waitflag));
success = aLock && EnterNonRecursiveMutex((PNRMUTEX) aLock, (waitflag == 1 ? INFINITE : 0)) == WAIT_OBJECT_0 ; success = aLock && EnterNonRecursiveMutex((PNRMUTEX) aLock, (waitflag == 1 ? INFINITE : 0)) == WAIT_OBJECT_0 ;
dprintf(("%ld: PyThread_acquire_lock(%lx, %d) -> %d\n", PyThread_get_thread_ident(),(long)aLock, waitflag, success)); dprintf(("%ld: PyThread_acquire_lock(%p, %d) -> %d\n", PyThread_get_thread_ident(),aLock, waitflag, success));
return success; return success;
} }
void PyThread_release_lock(PyThread_type_lock aLock) void PyThread_release_lock(PyThread_type_lock aLock)
{ {
dprintf(("%ld: PyThread_release_lock(%lx) called\n", PyThread_get_thread_ident(),(long)aLock)); dprintf(("%ld: PyThread_release_lock(%p) called\n", PyThread_get_thread_ident(),aLock));
if (!(aLock && LeaveNonRecursiveMutex((PNRMUTEX) aLock))) if (!(aLock && LeaveNonRecursiveMutex((PNRMUTEX) aLock)))
dprintf(("%ld: Could not PyThread_release_lock(%lx) error: %l\n", PyThread_get_thread_ident(), (long)aLock, GetLastError())); dprintf(("%ld: Could not PyThread_release_lock(%p) error: %l\n", PyThread_get_thread_ident(), aLock, GetLastError()));
} }
/* /*
@ -328,14 +328,14 @@ PyThread_type_sema PyThread_allocate_sema(int value)
INT_MAX, /* Maximum value */ INT_MAX, /* Maximum value */
NULL); /* Name of semaphore */ NULL); /* Name of semaphore */
dprintf(("%ld: PyThread_allocate_sema() -> %lx\n", PyThread_get_thread_ident(), (long)aSemaphore)); dprintf(("%ld: PyThread_allocate_sema() -> %p\n", PyThread_get_thread_ident(), aSemaphore));
return (PyThread_type_sema) aSemaphore; return (PyThread_type_sema) aSemaphore;
} }
void PyThread_free_sema(PyThread_type_sema aSemaphore) void PyThread_free_sema(PyThread_type_sema aSemaphore)
{ {
dprintf(("%ld: PyThread_free_sema(%lx) called\n", PyThread_get_thread_ident(), (long)aSemaphore)); dprintf(("%ld: PyThread_free_sema(%p) called\n", PyThread_get_thread_ident(), aSemaphore));
CloseHandle((HANDLE) aSemaphore); CloseHandle((HANDLE) aSemaphore);
} }
@ -347,11 +347,11 @@ int PyThread_down_sema(PyThread_type_sema aSemaphore, int waitflag)
{ {
DWORD waitResult; DWORD waitResult;
dprintf(("%ld: PyThread_down_sema(%lx) called\n", PyThread_get_thread_ident(), (long)aSemaphore)); dprintf(("%ld: PyThread_down_sema(%p) called\n", PyThread_get_thread_ident(), aSemaphore));
waitResult = WaitForSingleObject( (HANDLE) aSemaphore, INFINITE); waitResult = WaitForSingleObject( (HANDLE) aSemaphore, INFINITE);
dprintf(("%ld: PyThread_down_sema(%lx) return: %l\n", PyThread_get_thread_ident(),(long) aSemaphore, waitResult)); dprintf(("%ld: PyThread_down_sema(%p) return: %l\n", PyThread_get_thread_ident(), aSemaphore, waitResult));
return 0; return 0;
} }
@ -362,5 +362,5 @@ void PyThread_up_sema(PyThread_type_sema aSemaphore)
1, /* increment count by one */ 1, /* increment count by one */
NULL); /* not interested in previous count */ NULL); /* not interested in previous count */
dprintf(("%ld: PyThread_up_sema(%lx)\n", PyThread_get_thread_ident(), (long)aSemaphore)); dprintf(("%ld: PyThread_up_sema(%p)\n", PyThread_get_thread_ident(), aSemaphore));
} }

View file

@ -141,14 +141,14 @@ PyThread_type_lock PyThread_allocate_lock(void)
0, /* shared ? */ 0, /* shared ? */
0); /* initial state */ 0); /* initial state */
dprintf(("%ld: PyThread_allocate_lock() -> %lx\n", PyThread_get_thread_ident(), (long)aLock)); dprintf(("%ld: PyThread_allocate_lock() -> %p\n", PyThread_get_thread_ident(), aLock));
return (PyThread_type_lock) aLock; 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(%lx) called\n", PyThread_get_thread_ident(),(long)aLock)); dprintf(("%ld: PyThread_free_lock(%p) called\n", PyThread_get_thread_ident(),aLock));
DosCloseMutexSem((HMTX)aLock); DosCloseMutexSem((HMTX)aLock);
} }
@ -166,8 +166,8 @@ int PyThread_acquire_lock(PyThread_type_lock aLock, int waitflag)
PID pid = 0; PID pid = 0;
TID tid = 0; TID tid = 0;
dprintf(("%ld: PyThread_acquire_lock(%lx, %d) called\n", PyThread_get_thread_ident(), dprintf(("%ld: PyThread_acquire_lock(%p, %d) called\n", PyThread_get_thread_ident(),
(long)aLock, waitflag)); aLock, waitflag));
DosQueryMutexSem((HMTX)aLock,&pid,&tid,&count); DosQueryMutexSem((HMTX)aLock,&pid,&tid,&count);
if( tid == PyThread_get_thread_ident() ) { /* if we own this lock */ if( tid == PyThread_get_thread_ident() ) { /* if we own this lock */
@ -181,19 +181,19 @@ int PyThread_acquire_lock(PyThread_type_lock aLock, int waitflag)
} }
} }
dprintf(("%ld: PyThread_acquire_lock(%lx, %d) -> %d\n", dprintf(("%ld: PyThread_acquire_lock(%p, %d) -> %d\n",
PyThread_get_thread_ident(),(long)aLock, waitflag, success)); PyThread_get_thread_ident(),aLock, waitflag, success));
return success; return success;
} }
void PyThread_release_lock(PyThread_type_lock aLock) void PyThread_release_lock(PyThread_type_lock aLock)
{ {
dprintf(("%ld: PyThread_release_lock(%lx) called\n", PyThread_get_thread_ident(),(long)aLock)); dprintf(("%ld: PyThread_release_lock(%p) called\n", PyThread_get_thread_ident(),aLock));
if ( DosReleaseMutexSem( (HMTX) aLock ) != 0 ) { if ( DosReleaseMutexSem( (HMTX) aLock ) != 0 ) {
dprintf(("%ld: Could not PyThread_release_lock(%lx) error: %l\n", dprintf(("%ld: Could not PyThread_release_lock(%p) error: %l\n",
PyThread_get_thread_ident(), (long)aLock, GetLastError())); PyThread_get_thread_ident(), aLock, GetLastError()));
} }
} }
@ -217,5 +217,5 @@ int PyThread_down_sema(PyThread_type_sema aSemaphore, int waitflag)
void PyThread_up_sema(PyThread_type_sema aSemaphore) void PyThread_up_sema(PyThread_type_sema aSemaphore)
{ {
dprintf(("%ld: PyThread_up_sema(%lx)\n", PyThread_get_thread_ident(), (long)aSemaphore)); dprintf(("%ld: PyThread_up_sema(%p)\n", PyThread_get_thread_ident(), aSemaphore));
} }

View file

@ -168,7 +168,7 @@ PyThread_type_lock PyThread_allocate_lock _P0()
lock = NULL; lock = NULL;
} }
} }
dprintf(("PyThread_allocate_lock() -> %lx\n", (long)lock)); dprintf(("PyThread_allocate_lock() -> %p\n", lock));
return (PyThread_type_lock) lock; return (PyThread_type_lock) lock;
} }
@ -177,7 +177,7 @@ void PyThread_free_lock _P1(lock, PyThread_type_lock lock)
pth_lock *thelock = (pth_lock *)lock; pth_lock *thelock = (pth_lock *)lock;
int status, error = 0; int status, error = 0;
dprintf(("PyThread_free_lock(%lx) called\n", (long)lock)); dprintf(("PyThread_free_lock(%p) called\n", lock));
free((void *)thelock); free((void *)thelock);
} }
@ -188,7 +188,7 @@ int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitf
pth_lock *thelock = (pth_lock *)lock; pth_lock *thelock = (pth_lock *)lock;
int status, error = 0; int status, error = 0;
dprintf(("PyThread_acquire_lock(%lx, %d) called\n", (long)lock, waitflag)); dprintf(("PyThread_acquire_lock(%p, %d) called\n", lock, waitflag));
status = pth_mutex_acquire(&thelock->mut, !waitflag, NULL); status = pth_mutex_acquire(&thelock->mut, !waitflag, NULL);
CHECK_STATUS("pth_mutex_acquire[1]"); CHECK_STATUS("pth_mutex_acquire[1]");
@ -215,7 +215,7 @@ int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitf
success = 1; success = 1;
} }
if (error) success = 0; if (error) success = 0;
dprintf(("PyThread_acquire_lock(%lx, %d) -> %d\n", (long)lock, waitflag, success)); dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success));
return success; return success;
} }
@ -224,7 +224,7 @@ void PyThread_release_lock _P1(lock, PyThread_type_lock lock)
pth_lock *thelock = (pth_lock *)lock; pth_lock *thelock = (pth_lock *)lock;
int status, error = 0; int status, error = 0;
dprintf(("PyThread_release_lock(%lx) called\n", (long)lock)); dprintf(("PyThread_release_lock(%p) called\n", lock));
status = pth_mutex_acquire( &thelock->mut, 0, NULL ); status = pth_mutex_acquire( &thelock->mut, 0, NULL );
CHECK_STATUS("pth_mutex_acquire[3]"); CHECK_STATUS("pth_mutex_acquire[3]");
@ -270,7 +270,7 @@ PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
sema = NULL; sema = NULL;
} }
} }
dprintf(("PyThread_allocate_sema() -> %lx\n", (long) sema)); dprintf(("PyThread_allocate_sema() -> %p\n", sema));
return (PyThread_type_sema) sema; return (PyThread_type_sema) sema;
} }
@ -279,7 +279,7 @@ void PyThread_free_sema _P1(sema, PyThread_type_sema sema)
int status, error = 0; int status, error = 0;
struct semaphore *thesema = (struct semaphore *) sema; struct semaphore *thesema = (struct semaphore *) sema;
dprintf(("PyThread_free_sema(%lx) called\n", (long) sema)); dprintf(("PyThread_free_sema(%p) called\n", sema));
free((void *) thesema); free((void *) thesema);
} }
@ -288,7 +288,7 @@ int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag
int status, error = 0, success; int status, error = 0, success;
struct semaphore *thesema = (struct semaphore *) sema; struct semaphore *thesema = (struct semaphore *) sema;
dprintf(("PyThread_down_sema(%lx, %d) called\n", (long) sema, waitflag)); dprintf(("PyThread_down_sema(%p, %d) called\n", sema, waitflag));
status = pth_mutex_acquire(&thesema->mutex, !waitflag, NULL); status = pth_mutex_acquire(&thesema->mutex, !waitflag, NULL);
CHECK_STATUS("pth_mutex_acquire"); CHECK_STATUS("pth_mutex_acquire");
if (waitflag) { if (waitflag) {
@ -308,7 +308,7 @@ int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag
success = 0; success = 0;
status = pth_mutex_release(&thesema->mutex); status = pth_mutex_release(&thesema->mutex);
CHECK_STATUS("pth_mutex_release"); CHECK_STATUS("pth_mutex_release");
dprintf(("PyThread_down_sema(%lx) return\n", (long) sema)); dprintf(("PyThread_down_sema(%p) return\n", sema));
return success; return success;
} }
@ -317,7 +317,7 @@ void PyThread_up_sema _P1(sema, PyThread_type_sema sema)
int status, error = 0; int status, error = 0;
struct semaphore *thesema = (struct semaphore *) sema; struct semaphore *thesema = (struct semaphore *) sema;
dprintf(("PyThread_up_sema(%lx)\n", (long) sema)); dprintf(("PyThread_up_sema(%p)\n", sema));
status = pth_mutex_acquire(&thesema->mutex, 0, NULL); status = pth_mutex_acquire(&thesema->mutex, 0, NULL);
CHECK_STATUS("pth_mutex_acquire"); CHECK_STATUS("pth_mutex_acquire");
thesema->value++; thesema->value++;

View file

@ -272,7 +272,7 @@ PyThread_type_lock PyThread_allocate_lock _P0()
} }
} }
dprintf(("PyThread_allocate_lock() -> %lx\n", (long)lock)); dprintf(("PyThread_allocate_lock() -> %p\n", lock));
return (PyThread_type_lock) lock; return (PyThread_type_lock) lock;
} }
@ -281,7 +281,7 @@ void PyThread_free_lock _P1(lock, PyThread_type_lock lock)
pthread_lock *thelock = (pthread_lock *)lock; pthread_lock *thelock = (pthread_lock *)lock;
int status, error = 0; int status, error = 0;
dprintf(("PyThread_free_lock(%lx) called\n", (long)lock)); dprintf(("PyThread_free_lock(%p) called\n", lock));
status = pthread_mutex_destroy( &thelock->mut ); status = pthread_mutex_destroy( &thelock->mut );
CHECK_STATUS("pthread_mutex_destroy"); CHECK_STATUS("pthread_mutex_destroy");
@ -298,7 +298,7 @@ int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitf
pthread_lock *thelock = (pthread_lock *)lock; pthread_lock *thelock = (pthread_lock *)lock;
int status, error = 0; int status, error = 0;
dprintf(("PyThread_acquire_lock(%lx, %d) called\n", (long)lock, waitflag)); dprintf(("PyThread_acquire_lock(%p, %d) called\n", lock, waitflag));
status = pthread_mutex_lock( &thelock->mut ); status = pthread_mutex_lock( &thelock->mut );
CHECK_STATUS("pthread_mutex_lock[1]"); CHECK_STATUS("pthread_mutex_lock[1]");
@ -325,7 +325,7 @@ int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitf
success = 1; success = 1;
} }
if (error) success = 0; if (error) success = 0;
dprintf(("PyThread_acquire_lock(%lx, %d) -> %d\n", (long)lock, waitflag, success)); dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success));
return success; return success;
} }
@ -334,7 +334,7 @@ void PyThread_release_lock _P1(lock, PyThread_type_lock lock)
pthread_lock *thelock = (pthread_lock *)lock; pthread_lock *thelock = (pthread_lock *)lock;
int status, error = 0; int status, error = 0;
dprintf(("PyThread_release_lock(%lx) called\n", (long)lock)); dprintf(("PyThread_release_lock(%p) called\n", lock));
status = pthread_mutex_lock( &thelock->mut ); status = pthread_mutex_lock( &thelock->mut );
CHECK_STATUS("pthread_mutex_lock[3]"); CHECK_STATUS("pthread_mutex_lock[3]");
@ -382,7 +382,7 @@ PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
sema = NULL; sema = NULL;
} }
} }
dprintf(("PyThread_allocate_sema() -> %lx\n", (long) sema)); dprintf(("PyThread_allocate_sema() -> %p\n", sema));
return (PyThread_type_sema) sema; return (PyThread_type_sema) sema;
} }
@ -391,7 +391,7 @@ void PyThread_free_sema _P1(sema, PyThread_type_sema sema)
int status, error = 0; int status, error = 0;
struct semaphore *thesema = (struct semaphore *) sema; struct semaphore *thesema = (struct semaphore *) sema;
dprintf(("PyThread_free_sema(%lx) called\n", (long) sema)); dprintf(("PyThread_free_sema(%p) called\n", sema));
status = pthread_cond_destroy(&thesema->cond); status = pthread_cond_destroy(&thesema->cond);
CHECK_STATUS("pthread_cond_destroy"); CHECK_STATUS("pthread_cond_destroy");
status = pthread_mutex_destroy(&thesema->mutex); status = pthread_mutex_destroy(&thesema->mutex);
@ -404,7 +404,7 @@ int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag
int status, error = 0, success; int status, error = 0, success;
struct semaphore *thesema = (struct semaphore *) sema; struct semaphore *thesema = (struct semaphore *) sema;
dprintf(("PyThread_down_sema(%lx, %d) called\n", (long) sema, waitflag)); dprintf(("PyThread_down_sema(%p, %d) called\n", sema, waitflag));
status = pthread_mutex_lock(&thesema->mutex); status = pthread_mutex_lock(&thesema->mutex);
CHECK_STATUS("pthread_mutex_lock"); CHECK_STATUS("pthread_mutex_lock");
if (waitflag) { if (waitflag) {
@ -424,7 +424,7 @@ int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag
success = 0; success = 0;
status = pthread_mutex_unlock(&thesema->mutex); status = pthread_mutex_unlock(&thesema->mutex);
CHECK_STATUS("pthread_mutex_unlock"); CHECK_STATUS("pthread_mutex_unlock");
dprintf(("PyThread_down_sema(%lx) return\n", (long) sema)); dprintf(("PyThread_down_sema(%p) return\n", sema));
return success; return success;
} }
@ -433,7 +433,7 @@ void PyThread_up_sema _P1(sema, PyThread_type_sema sema)
int status, error = 0; int status, error = 0;
struct semaphore *thesema = (struct semaphore *) sema; struct semaphore *thesema = (struct semaphore *) sema;
dprintf(("PyThread_up_sema(%lx)\n", (long) sema)); dprintf(("PyThread_up_sema(%p)\n", sema));
status = pthread_mutex_lock(&thesema->mutex); status = pthread_mutex_lock(&thesema->mutex);
CHECK_STATUS("pthread_mutex_lock"); CHECK_STATUS("pthread_mutex_lock");
thesema->value++; thesema->value++;

View file

@ -119,7 +119,7 @@ static void PyThread__init_thread _P0()
if (usconfig(CONF_INITSIZE, size) < 0) if (usconfig(CONF_INITSIZE, size) < 0)
perror("usconfig - CONF_INITSIZE (reset)"); perror("usconfig - CONF_INITSIZE (reset)");
addr = (long) dl_getrange(size + HDR_SIZE); addr = (long) dl_getrange(size + HDR_SIZE);
dprintf(("trying to use addr %lx-%lx for shared arena\n", addr, addr+size)); dprintf(("trying to use addr %p-%p for shared arena\n", addr, addr+size));
errno = 0; errno = 0;
if ((addr = usconfig(CONF_ATTACHADDR, addr)) < 0 && errno != 0) if ((addr = usconfig(CONF_ATTACHADDR, addr)) < 0 && errno != 0)
perror("usconfig - CONF_ATTACHADDR (set)"); perror("usconfig - CONF_ATTACHADDR (set)");
@ -157,7 +157,7 @@ static void PyThread__init_thread _P0()
(void) usinitlock(count_lock); (void) usinitlock(count_lock);
if ((wait_lock = usnewlock(shared_arena)) == NULL) if ((wait_lock = usnewlock(shared_arena)) == NULL)
perror("usnewlock (wait_lock)"); perror("usnewlock (wait_lock)");
dprintf(("arena start: %lx, arena size: %ld\n", (long) shared_arena, (long) usconfig(CONF_GETSIZE, shared_arena))); dprintf(("arena start: %p, arena size: %ld\n", shared_arena, (long) usconfig(CONF_GETSIZE, shared_arena)));
} }
/* /*
@ -224,7 +224,7 @@ int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *ar
if (usconfig(CONF_INITSIZE, size) < 0) if (usconfig(CONF_INITSIZE, size) < 0)
perror("usconfig - CONF_INITSIZE (reset)"); perror("usconfig - CONF_INITSIZE (reset)");
addr = (long) dl_getrange(size + HDR_SIZE); addr = (long) dl_getrange(size + HDR_SIZE);
dprintf(("trying to use addr %lx-%lx for sproc\n", dprintf(("trying to use addr %p-%p for sproc\n",
addr, addr+size)); addr, addr+size));
errno = 0; errno = 0;
if ((addr = usconfig(CONF_ATTACHADDR, addr)) < 0 && if ((addr = usconfig(CONF_ATTACHADDR, addr)) < 0 &&
@ -375,13 +375,13 @@ PyThread_type_lock PyThread_allocate_lock _P0()
if ((lock = usnewlock(shared_arena)) == NULL) if ((lock = usnewlock(shared_arena)) == NULL)
perror("usnewlock"); perror("usnewlock");
(void) usinitlock(lock); (void) usinitlock(lock);
dprintf(("PyThread_allocate_lock() -> %lx\n", (long)lock)); dprintf(("PyThread_allocate_lock() -> %p\n", lock));
return (PyThread_type_lock) lock; return (PyThread_type_lock) lock;
} }
void PyThread_free_lock _P1(lock, PyThread_type_lock lock) void PyThread_free_lock _P1(lock, PyThread_type_lock lock)
{ {
dprintf(("PyThread_free_lock(%lx) called\n", (long)lock)); dprintf(("PyThread_free_lock(%p) called\n", lock));
usfreelock((ulock_t) lock, shared_arena); usfreelock((ulock_t) lock, shared_arena);
} }
@ -389,7 +389,7 @@ int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitf
{ {
int success; int success;
dprintf(("PyThread_acquire_lock(%lx, %d) called\n", (long)lock, waitflag)); dprintf(("PyThread_acquire_lock(%p, %d) called\n", lock, waitflag));
errno = 0; /* clear it just in case */ errno = 0; /* clear it just in case */
if (waitflag) if (waitflag)
success = ussetlock((ulock_t) lock); success = ussetlock((ulock_t) lock);
@ -397,13 +397,13 @@ int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitf
success = uscsetlock((ulock_t) lock, 1); /* Try it once */ success = uscsetlock((ulock_t) lock, 1); /* Try it once */
if (success < 0) if (success < 0)
perror(waitflag ? "ussetlock" : "uscsetlock"); perror(waitflag ? "ussetlock" : "uscsetlock");
dprintf(("PyThread_acquire_lock(%lx, %d) -> %d\n", (long)lock, waitflag, success)); dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success));
return success; return success;
} }
void PyThread_release_lock _P1(lock, PyThread_type_lock lock) void PyThread_release_lock _P1(lock, PyThread_type_lock lock)
{ {
dprintf(("PyThread_release_lock(%lx) called\n", (long)lock)); dprintf(("PyThread_release_lock(%p) called\n", lock));
if (usunsetlock((ulock_t) lock) < 0) if (usunsetlock((ulock_t) lock) < 0)
perror("usunsetlock"); perror("usunsetlock");
} }
@ -420,13 +420,13 @@ PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
if ((sema = usnewsema(shared_arena, value)) == NULL) if ((sema = usnewsema(shared_arena, value)) == NULL)
perror("usnewsema"); perror("usnewsema");
dprintf(("PyThread_allocate_sema() -> %lx\n", (long) sema)); dprintf(("PyThread_allocate_sema() -> %p\n", sema));
return (PyThread_type_sema) sema; return (PyThread_type_sema) sema;
} }
void PyThread_free_sema _P1(sema, PyThread_type_sema sema) void PyThread_free_sema _P1(sema, PyThread_type_sema sema)
{ {
dprintf(("PyThread_free_sema(%lx) called\n", (long) sema)); dprintf(("PyThread_free_sema(%p) called\n", sema));
usfreesema((usema_t *) sema, shared_arena); usfreesema((usema_t *) sema, shared_arena);
} }
@ -434,20 +434,20 @@ int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag
{ {
int success; int success;
dprintf(("PyThread_down_sema(%lx) called\n", (long) sema)); dprintf(("PyThread_down_sema(%p) called\n", sema));
if (waitflag) if (waitflag)
success = uspsema((usema_t *) sema); success = uspsema((usema_t *) sema);
else else
success = uscpsema((usema_t *) sema); success = uscpsema((usema_t *) sema);
if (success < 0) if (success < 0)
perror(waitflag ? "uspsema" : "uscpsema"); perror(waitflag ? "uspsema" : "uscpsema");
dprintf(("PyThread_down_sema(%lx) return\n", (long) sema)); dprintf(("PyThread_down_sema(%p) return\n", sema));
return success; return success;
} }
void PyThread_up_sema _P1(sema, PyThread_type_sema sema) void PyThread_up_sema _P1(sema, PyThread_type_sema sema)
{ {
dprintf(("PyThread_up_sema(%lx)\n", (long) sema)); dprintf(("PyThread_up_sema(%p)\n", sema));
if (usvsema((usema_t *) sema) < 0) if (usvsema((usema_t *) sema) < 0)
perror("usvsema"); perror("usvsema");
} }

View file

@ -157,13 +157,13 @@ PyThread_type_lock PyThread_allocate_lock _P0()
free((void *) lock); free((void *) lock);
lock = 0; lock = 0;
} }
dprintf(("PyThread_allocate_lock() -> %lx\n", (long)lock)); dprintf(("PyThread_allocate_lock() -> %p\n", lock));
return (PyThread_type_lock) lock; return (PyThread_type_lock) lock;
} }
void PyThread_free_lock _P1(lock, PyThread_type_lock lock) void PyThread_free_lock _P1(lock, PyThread_type_lock lock)
{ {
dprintf(("PyThread_free_lock(%lx) called\n", (long)lock)); dprintf(("PyThread_free_lock(%p) called\n", lock));
mutex_destroy((mutex_t *) lock); mutex_destroy((mutex_t *) lock);
free((void *) lock); free((void *) lock);
} }
@ -172,7 +172,7 @@ int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitf
{ {
int success; int success;
dprintf(("PyThread_acquire_lock(%lx, %d) called\n", (long)lock, waitflag)); dprintf(("PyThread_acquire_lock(%p, %d) called\n", lock, waitflag));
if (waitflag) if (waitflag)
success = mutex_lock((mutex_t *) lock); success = mutex_lock((mutex_t *) lock);
else else
@ -181,13 +181,13 @@ int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitf
perror(waitflag ? "mutex_lock" : "mutex_trylock"); perror(waitflag ? "mutex_lock" : "mutex_trylock");
else else
success = !success; /* solaris does it the other way round */ success = !success; /* solaris does it the other way round */
dprintf(("PyThread_acquire_lock(%lx, %d) -> %d\n", (long)lock, waitflag, success)); dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success));
return success; return success;
} }
void PyThread_release_lock _P1(lock, PyThread_type_lock lock) void PyThread_release_lock _P1(lock, PyThread_type_lock lock)
{ {
dprintf(("PyThread_release_lock(%lx) called\n", (long)lock)); dprintf(("PyThread_release_lock(%p) called\n", lock));
if (mutex_unlock((mutex_t *) lock)) if (mutex_unlock((mutex_t *) lock))
perror("mutex_unlock"); perror("mutex_unlock");
} }
@ -208,13 +208,13 @@ PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
free((void *) sema); free((void *) sema);
sema = 0; sema = 0;
} }
dprintf(("PyThread_allocate_sema() -> %lx\n", (long) sema)); dprintf(("PyThread_allocate_sema() -> %p\n", sema));
return (PyThread_type_sema) sema; return (PyThread_type_sema) sema;
} }
void PyThread_free_sema _P1(sema, PyThread_type_sema sema) void PyThread_free_sema _P1(sema, PyThread_type_sema sema)
{ {
dprintf(("PyThread_free_sema(%lx) called\n", (long) sema)); dprintf(("PyThread_free_sema(%p) called\n", sema));
if (sema_destroy((sema_t *) sema)) if (sema_destroy((sema_t *) sema))
perror("sema_destroy"); perror("sema_destroy");
free((void *) sema); free((void *) sema);
@ -224,7 +224,7 @@ int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag
{ {
int success; int success;
dprintf(("PyThread_down_sema(%lx) called\n", (long) sema)); dprintf(("PyThread_down_sema(%p) called\n", sema));
if (waitflag) if (waitflag)
success = sema_wait((sema_t *) sema); success = sema_wait((sema_t *) sema);
else else
@ -237,13 +237,13 @@ int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag
} }
else else
success = !success; success = !success;
dprintf(("PyThread_down_sema(%lx) return %d\n", (long) sema, success)); dprintf(("PyThread_down_sema(%p) return %d\n", sema, success));
return success; return success;
} }
void PyThread_up_sema _P1(sema, PyThread_type_sema sema) void PyThread_up_sema _P1(sema, PyThread_type_sema sema)
{ {
dprintf(("PyThread_up_sema(%lx)\n", (long) sema)); dprintf(("PyThread_up_sema(%p)\n", sema));
if (sema_post((sema_t *) sema)) if (sema_post((sema_t *) sema))
perror("sema_post"); perror("sema_post");
} }

View file

@ -144,14 +144,14 @@ PyThread_type_lock PyThread_allocate_lock(void)
1, /* Is initially signalled */ 1, /* Is initially signalled */
NULL); /* Name of event */ NULL); /* Name of event */
dprintf(("%ld: PyThread_allocate_lock() -> %lx\n", PyThread_get_thread_ident(), (long)aLock)); dprintf(("%ld: PyThread_allocate_lock() -> %p\n", PyThread_get_thread_ident(), aLock));
return (PyThread_type_lock) aLock; 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(%lx) called\n", PyThread_get_thread_ident(),(long)aLock)); dprintf(("%ld: PyThread_free_lock(%p) called\n", PyThread_get_thread_ident(),aLock));
CloseHandle(aLock); CloseHandle(aLock);
} }
@ -167,7 +167,7 @@ int PyThread_acquire_lock(PyThread_type_lock aLock, int waitflag)
int success = 1; int success = 1;
DWORD waitResult; DWORD waitResult;
dprintf(("%ld: PyThread_acquire_lock(%lx, %d) called\n", PyThread_get_thread_ident(),(long)aLock, waitflag)); dprintf(("%ld: PyThread_acquire_lock(%p, %d) called\n", PyThread_get_thread_ident(),aLock, waitflag));
#ifndef DEBUG #ifndef DEBUG
waitResult = WaitForSingleObject(aLock, (waitflag == 1 ? INFINITE : 0)); waitResult = WaitForSingleObject(aLock, (waitflag == 1 ? INFINITE : 0));
@ -185,17 +185,17 @@ int PyThread_acquire_lock(PyThread_type_lock aLock, int waitflag)
success = 0; /* We failed */ success = 0; /* We failed */
} }
dprintf(("%ld: PyThread_acquire_lock(%lx, %d) -> %d\n", PyThread_get_thread_ident(),(long)aLock, waitflag, success)); dprintf(("%ld: PyThread_acquire_lock(%p, %d) -> %d\n", PyThread_get_thread_ident(),aLock, waitflag, success));
return success; return success;
} }
void PyThread_release_lock(PyThread_type_lock aLock) void PyThread_release_lock(PyThread_type_lock aLock)
{ {
dprintf(("%ld: PyThread_release_lock(%lx) called\n", PyThread_get_thread_ident(),(long)aLock)); dprintf(("%ld: PyThread_release_lock(%p) called\n", PyThread_get_thread_ident(),aLock));
if (!SetEvent(aLock)) if (!SetEvent(aLock))
dprintf(("%ld: Could not PyThread_release_lock(%lx) error: %l\n", PyThread_get_thread_ident(), (long)aLock, GetLastError())); dprintf(("%ld: Could not PyThread_release_lock(%p) error: %l\n", PyThread_get_thread_ident(), aLock, GetLastError()));
} }