p_multiple_threads (__pthread_main_thread) = 1;
__pthread_main_thread->p_multiple_threads = 1;
int __pthread_initialize_manager(void){  int manager_pipe[2];  int pid;  struct pthread_request request;  int report_events;  pthread_descr mgr;#ifdef USE_TLS  tcbhead_t *tcbp;#endif  __pthread_multiple_threads = 1;#if TLS_MULTIPLE_THREADS_IN_TCB || !defined USE_TLS || !TLS_DTV_AT_TP  p_multiple_threads (__pthread_main_thread) = 1;#endif  *__libc_multiple_threads_ptr = 1;#ifndef HAVE_Z_NODELETE  if (__builtin_expect (&__dso_handle != NULL, 1))    __cxa_atexit ((void (*) (void *)) pthread_atexit_retcode, NULL,		  __dso_handle);#endif  if (__pthread_max_stacksize == 0)    __pthread_init_max_stacksize ();  /* If basic initialization not done yet (e.g. we're called from a     constructor run before our constructor), do it now */  if (__pthread_initial_thread_bos == NULL) pthread_initialize();  /* Setup stack for thread manager */  __pthread_manager_thread_bos = malloc(THREAD_MANAGER_STACK_SIZE);  if (__pthread_manager_thread_bos == NULL) return -1;  __pthread_manager_thread_tos =    __pthread_manager_thread_bos + THREAD_MANAGER_STACK_SIZE;  /* Setup pipe to communicate with thread manager */  if (pipe(manager_pipe) == -1) {    free(__pthread_manager_thread_bos);    return -1;  }#ifdef USE_TLS  /* Allocate memory for the thread descriptor and the dtv.  */  tcbp  = _dl_allocate_tls (NULL);  if (tcbp == NULL) {    free(__pthread_manager_thread_bos);    __libc_close(manager_pipe[0]);    __libc_close(manager_pipe[1]);    return -1;  }# if TLS_TCB_AT_TP  mgr = (pthread_descr) tcbp;# elif TLS_DTV_AT_TP  /* pthread_descr is located right below tcbhead_t which _dl_allocate_tls     returns.  */  mgr = (pthread_descr) ((char *) tcbp - TLS_PRE_TCB_SIZE);# endif  __pthread_handles[1].h_descr = manager_thread = mgr;  /* Initialize the descriptor.  */#if !defined USE_TLS || !TLS_DTV_AT_TP  mgr->p_header.data.tcb = tcbp;  mgr->p_header.data.self = mgr;  p_multiple_threads (mgr) = 1;#elif TLS_MULTIPLE_THREADS_IN_TCB  p_multiple_threads (mgr) = 1;#endif  mgr->p_lock = &__pthread_handles[1].h_lock;# ifndef HAVE___THREAD  mgr->p_errnop = &mgr->p_errno;# endif  mgr->p_start_args = (struct pthread_start_args) PTHREAD_START_ARGS_INITIALIZER(__pthread_manager);  mgr->p_nr = 1;# if __LT_SPINLOCK_INIT != 0  self->p_resume_count = (struct pthread_atomic) __ATOMIC_INITIALIZER;# endif  mgr->p_alloca_cutoff = PTHREAD_STACK_MIN / 4;#else  mgr = &__pthread_manager_thread;#endif  __pthread_manager_request = manager_pipe[1]; /* writing end */  __pthread_manager_reader = manager_pipe[0]; /* reading end */  /* Start the thread manager */  pid = 0;#ifdef USE_TLS  if (__linuxthreads_initial_report_events != 0)    THREAD_SETMEM (((pthread_descr) NULL), p_report_events,		   __linuxthreads_initial_report_events);  report_events = THREAD_GETMEM (((pthread_descr) NULL), p_report_events);#else  if (__linuxthreads_initial_report_events != 0)    __pthread_initial_thread.p_report_events      = __linuxthreads_initial_report_events;  report_events = __pthread_initial_thread.p_report_events;#endif  if (__builtin_expect (report_events, 0))    {      /* It's a bit more complicated.  We have to report the creation of	 the manager thread.  */      int idx = __td_eventword (TD_CREATE);      uint32_t mask = __td_eventmask (TD_CREATE);      uint32_t event_bits;#ifdef USE_TLS      event_bits = THREAD_GETMEM_NC (((pthread_descr) NULL),				     p_eventbuf.eventmask.event_bits[idx]);#else      event_bits = __pthread_initial_thread.p_eventbuf.eventmask.event_bits[idx];#endif      if ((mask & (__pthread_threads_events.event_bits[idx] | event_bits))	  != 0)	{	  __pthread_lock(mgr->p_lock, NULL);#ifdef NEED_SEPARATE_REGISTER_STACK	  pid = __clone2(__pthread_manager_event,			 (void **) __pthread_manager_thread_bos,			 THREAD_MANAGER_STACK_SIZE,			 CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND,			 mgr);#elif _STACK_GROWS_UP	  pid = __clone(__pthread_manager_event,			(void **) __pthread_manager_thread_bos,			CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND,			mgr);#else	  pid = __clone(__pthread_manager_event,			(void **) __pthread_manager_thread_tos,			CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND,			mgr);#endif	  if (pid != -1)	    {	      /* Now fill in the information about the new thread in	         the newly created thread's data structure.  We cannot let	         the new thread do this since we don't know whether it was	         already scheduled when we send the event.  */	      mgr->p_eventbuf.eventdata = mgr;	      mgr->p_eventbuf.eventnum = TD_CREATE;	      __pthread_last_event = mgr;	      mgr->p_tid = 2* PTHREAD_THREADS_MAX + 1;	      mgr->p_pid = pid;	      /* Now call the function which signals the event.  */	      __linuxthreads_create_event ();	    }	  /* Now restart the thread.  */	  __pthread_unlock(mgr->p_lock);	}    }  if (__builtin_expect (pid, 0) == 0)    {#ifdef NEED_SEPARATE_REGISTER_STACK      pid = __clone2(__pthread_manager, (void **) __pthread_manager_thread_bos,		     THREAD_MANAGER_STACK_SIZE,		     CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND, mgr);#elif _STACK_GROWS_UP      pid = __clone(__pthread_manager, (void **) __pthread_manager_thread_bos,		    CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND, mgr);#else      pid = __clone(__pthread_manager, (void **) __pthread_manager_thread_tos,		    CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND, mgr);#endif    }  if (__builtin_expect (pid, 0) == -1) {    free(__pthread_manager_thread_bos);    __libc_close(manager_pipe[0]);    __libc_close(manager_pipe[1]);    return -1;  }  mgr->p_tid = 2* PTHREAD_THREADS_MAX + 1;  mgr->p_pid = pid;  /* Make gdb aware of new thread manager */  if (__builtin_expect (__pthread_threads_debug, 0) && __pthread_sig_debug > 0)    {      raise(__pthread_sig_debug);      /* We suspend ourself and gdb will wake us up when it is	 ready to handle us. */      __pthread_wait_for_restart_signal(thread_self());    }  /* Synchronize debugging of the thread manager */  request.req_kind = REQ_DEBUG;  TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,				  (char *) &request, sizeof(request)));  return 0;}