mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
Change the isc_thread_self() return type to uintptr_t
The pthread_self(), thrd_current() or GetCurrentThreadId() could actually be a pointer, so we should rather convert the value into uintptr_t instead of unsigned long.
This commit is contained in:
parent
bea333f7c9
commit
a0181056a8
8 changed files with 20 additions and 19 deletions
|
|
@ -52,6 +52,6 @@ isc_thread_setname(isc_thread_t thread, const char *name);
|
|||
isc_result_t
|
||||
isc_thread_setaffinity(int cpu);
|
||||
|
||||
#define isc_thread_self (unsigned long)pthread_self
|
||||
#define isc_thread_self (uintptr_t) pthread_self
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ isc__rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type);
|
|||
static void
|
||||
print_lock(const char *operation, isc_rwlock_t *rwl, isc_rwlocktype_t type) {
|
||||
fprintf(stderr,
|
||||
"rwlock %p thread %lu %s(%s): "
|
||||
"rwlock %p thread %" PRIuPTR " %s(%s): "
|
||||
"write_requests=%u, write_completions=%u, "
|
||||
"cnt_and_flag=0x%x, readers_waiting=%u, "
|
||||
"write_granted=%u, write_quota=%u\n",
|
||||
|
|
|
|||
|
|
@ -61,13 +61,14 @@
|
|||
*/
|
||||
|
||||
#ifdef ISC_TASK_TRACE
|
||||
#define XTRACE(m) \
|
||||
fprintf(stderr, "task %p thread %lu: %s\n", task, isc_thread_self(), \
|
||||
(m))
|
||||
#define XTTRACE(t, m) \
|
||||
fprintf(stderr, "task %p thread %lu: %s\n", (t), isc_thread_self(), (m))
|
||||
#define XTRACE(m) \
|
||||
fprintf(stderr, "task %p thread %" PRIuPTR ": %s\n", task, \
|
||||
isc_thread_self(), (m))
|
||||
#define XTTRACE(t, m) \
|
||||
fprintf(stderr, "task %p thread %" PRIuPTR ": %s\n", (t), \
|
||||
isc_thread_self(), (m))
|
||||
#define XTHREADTRACE(m) \
|
||||
fprintf(stderr, "thread %lu: %s\n", isc_thread_self(), (m))
|
||||
fprintf(stderr, "thread %" PRIuPTR ": %s\n", isc_thread_self(), (m))
|
||||
#else /* ifdef ISC_TASK_TRACE */
|
||||
#define XTRACE(m)
|
||||
#define XTTRACE(t, m)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
struct isc__trampoline {
|
||||
int tid; /* const */
|
||||
isc_thread_t self;
|
||||
uintptr_t self;
|
||||
isc_threadfunc_t start;
|
||||
isc_threadarg_t arg;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ register_thread(unsigned long thrd, isc_condition_t *gblcond,
|
|||
}
|
||||
|
||||
static isc_result_t
|
||||
find_thread_condition(unsigned long thrd, isc_condition_t *cond,
|
||||
find_thread_condition(uintptr_t thrd, isc_condition_t *cond,
|
||||
isc_condition_thread_t **threadcondp) {
|
||||
isc_condition_thread_t *threadcond;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
typedef struct isc_condition_thread isc_condition_thread_t;
|
||||
|
||||
struct isc_condition_thread {
|
||||
unsigned long th;
|
||||
HANDLE handle[2];
|
||||
uintptr_t th;
|
||||
HANDLE handle[2];
|
||||
ISC_LINK(isc_condition_thread_t) link;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#ifndef ISC_THREAD_H
|
||||
#define ISC_THREAD_H 1
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include <isc/lang.h>
|
||||
|
|
@ -68,7 +69,7 @@ typedef DWORD isc_threadresult_t;
|
|||
typedef void * isc_threadarg_t;
|
||||
typedef isc_threadresult_t(WINAPI *isc_threadfunc_t)(isc_threadarg_t);
|
||||
|
||||
#define isc_thread_self (unsigned long)GetCurrentThreadId
|
||||
#define isc_thread_self (uintptr_t) GetCurrentThreadId
|
||||
|
||||
ISC_LANG_BEGINDECLS
|
||||
|
||||
|
|
|
|||
|
|
@ -161,18 +161,17 @@ client_trace(ns_client_t *client, int level, const char *message) {
|
|||
sizeof(tbuf));
|
||||
isc_log_write(ns_lctx, NS_LOGCATEGORY_CLIENT,
|
||||
NS_LOGMODULE_QUERY, level,
|
||||
"query client=%p thread=0x%lx "
|
||||
"query client=%p thread=0x%" PRIxPTR
|
||||
"(%s/%s): %s",
|
||||
client, (unsigned long)isc_thread_self(),
|
||||
qbuf, tbuf, message);
|
||||
client, isc_thread_self(), qbuf, tbuf,
|
||||
message);
|
||||
}
|
||||
} else {
|
||||
isc_log_write(ns_lctx, NS_LOGCATEGORY_CLIENT,
|
||||
NS_LOGMODULE_QUERY, level,
|
||||
"query client=%p thread=0x%lx "
|
||||
"query client=%p thread=0x%" PRIxPTR
|
||||
"(<unknown-query>): %s",
|
||||
client, (unsigned long)isc_thread_self(),
|
||||
message);
|
||||
client, isc_thread_self(), message);
|
||||
}
|
||||
}
|
||||
#define CTRACE(l, m) client_trace(client, l, m)
|
||||
|
|
|
|||
Loading…
Reference in a new issue