pthread_attr_destroy(&cta); } return LWP_EINIT; }
LWP_CreateProcess(void (*ep)(), int stacksize, int priority,                  char *parm, char *name, PROCESS *pid){    PROCESS temp;    pthread_t	ct;    pthread_attr_t cta;    PROCESS old_cpptr;    int retval;    Debug(0, ("Entered LWP_CreateProcess to create %s at priority %d\n", 	      name, priority));    old_cpptr = lwp_cpptr;    /* Throw away all dead process control blocks */    purge_dead_pcbs();    if (lwp_init) {      /* allocate the memory for the pcb - check for malloc errors */      temp = (PROCESS)malloc (sizeof (struct lwp_pcb));      if (temp == NULL) {	Dispatcher();	return LWP_ENOMEM;      }      /* check priorities */      if (priority < 0 || priority >= MAX_PRIORITIES) {	Dispatcher();	return LWP_EBADPRI;      }            Initialize_PCB(temp, priority, NULL, 0, ep, parm, name);            /* make the process runnable by placing it in the runnable q */      lwpinsert(temp, &runnable[priority]);      gettimeofday(&temp->lastReady, 0);      if (PRE_Block != 0) Abort_LWP("PRE_Block not 0");            PRE_Block = 1;      Proc_Running = FALSE;	    /* sem set true by forked process */            pthread_attr_init(&cta);#ifdef _POSIX_THREAD_ATTR_STACKSIZE      pthread_attr_setstacksize(&cta, stacksize);#endif      retval = pthread_create(&ct, &cta, (void *)Create_Process_Part2, temp);      if (!retval) {	temp->a = cta;	pthread_detach(ct);	/* check if max priority has changed */	Highest_runnable_priority = MAX(Highest_runnable_priority, priority);		pthread_mutex_lock(&run_sem);	Debug(0, ("Before creating process yields Proc_Running = %d\n", 		  Proc_Running));	while( !Proc_Running ){	  pthread_mutex_unlock(&run_sem);#if defined(HAVE_THR_YIELD)	  thr_yield();#elif defined(_POSIX_THREAD_PRIORITY_SCHEDULING)	  sched_yield();#else	  pthread_yield();#endif	  pthread_mutex_lock(&run_sem);	  Debug(0,("After creating proc yields and gets back control Proc_Running = %d\n", 		    Proc_Running));	}	pthread_mutex_unlock(&run_sem);		lwp_cpptr = old_cpptr;	  	Dispatcher();	*pid = temp;	return LWP_SUCCESS;      }    } else {      pthread_attr_destroy(&cta);    }    return LWP_EINIT;}