pthread_descr self = thread_self();
pthread_descr joining;
struct pthread_request request;
-PDEBUG("self=%p, pid=%d\n", self, self->p_pid);
+ PDEBUG("self=%p, pid=%d\n", self, self->p_pid);
/* Reset the cancellation flag to avoid looping if the cleanup handlers
contain cancellation points */
THREAD_SETMEM(self, p_terminated, 1);
/* See if someone is joining on us */
joining = THREAD_GETMEM(self, p_joining);
-PDEBUG("joining = %p, pid=%d\n", joining, joining->p_pid);
+ PDEBUG("joining = %p, pid=%d\n", joining, joining->p_pid);
__pthread_unlock(THREAD_GETMEM(self, p_lock));
/* Restart joining thread if any */
if (joining != NULL) restart(joining);
pthread_descr th;
pthread_extricate_if extr;
int already_canceled = 0;
-PDEBUG("\n");
+ PDEBUG("\n");
/* Set up extrication interface */
extr.pu_object = handle;
pthread_exit(PTHREAD_CANCELED);
}
-PDEBUG("before suspend\n");
+ PDEBUG("before suspend\n");
suspend(self);
-PDEBUG("after suspend\n");
+ PDEBUG("after suspend\n");
/* Deregister extrication interface */
__pthread_set_own_extricate_if(self, 0);
FD_SET (reqfd, &fd);
n = select (reqfd + 1, &fd, NULL, NULL, &tv);
#else
-PDEBUG("before poll\n");
+ PDEBUG("before poll\n");
n = poll(&ufd, 1, 2000);
-PDEBUG("after poll\n");
+ PDEBUG("after poll\n");
#endif
/* Check for termination of the main thread */
if (getppid() == 1) {
#endif
{
-PDEBUG("before __libc_read\n");
+ PDEBUG("before __libc_read\n");
n = __libc_read(reqfd, (char *)&request, sizeof(request));
-PDEBUG("after __libc_read, n=%d\n", n);
+ PDEBUG("after __libc_read, n=%d\n", n);
ASSERT(n == sizeof(request));
switch(request.req_kind) {
case REQ_CREATE:
-PDEBUG("got REQ_CREATE\n");
+ PDEBUG("got REQ_CREATE\n");
request.req_thread->p_retcode =
pthread_handle_create((pthread_t *) &request.req_thread->p_retval,
request.req_args.create.attr,
request.req_args.create.arg,
&request.req_args.create.mask,
request.req_thread->p_pid,
- request.req_thread->p_report_events,
- &request.req_thread->p_eventbuf.eventmask);
-PDEBUG("restarting %d\n", request.req_thread);
+ request.req_thread->p_report_events,
+ &request.req_thread->p_eventbuf.eventmask);
+ PDEBUG("restarting %d\n", request.req_thread);
restart(request.req_thread);
break;
case REQ_FREE:
-PDEBUG("got REQ_FREE\n");
- pthread_handle_free(request.req_args.free.thread_id);
+ PDEBUG("got REQ_FREE\n");
+ pthread_handle_free(request.req_args.free.thread_id);
break;
case REQ_PROCESS_EXIT:
-PDEBUG("got REQ_PROCESS_EXIT from %d, exit code = %d\n",
- request.req_thread, request.req_args.exit.code);
+ PDEBUG("got REQ_PROCESS_EXIT from %d, exit code = %d\n",
+ request.req_thread, request.req_args.exit.code);
pthread_handle_exit(request.req_thread,
request.req_args.exit.code);
break;
case REQ_MAIN_THREAD_EXIT:
-PDEBUG("got REQ_MAIN_THREAD_EXIT\n");
+ PDEBUG("got REQ_MAIN_THREAD_EXIT\n");
main_thread_exiting = 1;
/* Reap children in case all other threads died and the signal handler
went off before we set main_thread_exiting to 1, and therefore did
}
break;
case REQ_POST:
-PDEBUG("got REQ_POST\n");
+ PDEBUG("got REQ_POST\n");
__new_sem_post(request.req_args.post);
break;
case REQ_DEBUG:
-PDEBUG("got REQ_DEBUG\n");
+ PDEBUG("got REQ_DEBUG\n");
/* Make gdb aware of new thread and gdb will restart the
new thread when it is ready to handle the new thread. */
if (__pthread_threads_debug && __pthread_sig_debug > 0) {
-PDEBUG("about to call raise(__pthread_sig_debug)\n");
+ PDEBUG("about to call raise(__pthread_sig_debug)\n");
raise(__pthread_sig_debug);
}
case REQ_KICK:
#ifdef INIT_THREAD_SELF
INIT_THREAD_SELF(self, self->p_nr);
#endif
-PDEBUG("\n");
+ PDEBUG("\n");
/* Make sure our pid field is initialized, just in case we get there
before our father has initialized it. */
THREAD_SETMEM(self, p_pid, __getpid());
}
if (pid == 0)
{
-PDEBUG("cloning new_thread = %p\n", new_thread);
+ PDEBUG("cloning new_thread = %p\n", new_thread);
pid = clone(pthread_start_thread, (void **) new_thread,
CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND |
__pthread_sig_cancel, new_thread);
__pthread_handles_num--;
return errno;
}
-PDEBUG("new thread pid = %d\n", pid);
+ PDEBUG("new thread pid = %d\n", pid);
#if 0
/* ***********************************************************
{
pid_t pid;
int status;
-PDEBUG("\n");
+ PDEBUG("\n");
while ((pid = __libc_waitpid(-1, &status, WNOHANG | __WCLONE)) > 0) {
pthread_exited(pid);
__pthread_wait_for_restart_signal(thread_self());
}
/* Synchronize debugging of the thread manager */
-PDEBUG("send REQ_DEBUG to manager thread\n");
+ PDEBUG("send REQ_DEBUG to manager thread\n");
request.req_kind = REQ_DEBUG;
TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,
(char *) &request, sizeof(request)));
PDEBUG("write REQ_CREATE to manager thread\n");
TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,
(char *) &request, sizeof(request)));
-PDEBUG("before suspend(self)\n");
+ PDEBUG("before suspend(self)\n");
suspend(self);
-PDEBUG("after suspend(self)\n");
+ PDEBUG("after suspend(self)\n");
if (THREAD_GETMEM(self, p_retcode) == 0)
*thread = (pthread_t) THREAD_GETMEM(self, p_retval);
return THREAD_GETMEM(self, p_retcode);
#ifdef DEBUG_PT
if (h->h_descr == NULL) {
- printf("*** "__FUNCTION__" ERROR descriptor is NULL!!!!! ***\n\n");
+ printf("*** %s ERROR descriptor is NULL!!!!! ***\n\n", __FUNCTION__);
_exit(1);
}
#endif