Example #1
0
int main (int argc, char *argv[])
{
   printf ("Main INICIO\n") ;

   task_init () ;

   sem_create (&s1, 1) ;
   sem_create (&s2, 0) ;

   task_create (&a1, TaskA, "A1") ;
   task_create (&a2, TaskA, "  A2") ;
   task_create (&b1, TaskB, "             B1") ;
   task_create (&b2, TaskB, "               B2") ;

   task_join (&a1) ;

   sem_destroy (&s1) ;
   sem_destroy (&s2) ;

   task_join (&a2) ;
   task_join (&b1) ;
   task_join (&b2) ;

   printf ("Main FIM\n") ;
   task_exit (0) ;

   exit (0) ;
}
static
void
inititems(void)
{
	if (BrSem==NULL) {
		BrSem = sem_create("BrSem", 3);
		if (BrSem == NULL) {
			panic("BrSem: sem_create failed\n");
		}
	}
	if (doneSem==NULL) {
		doneSem = sem_create("doneSem", 0);
		if (doneSem == NULL) {
			panic("synchtest: sem_create failed\n");
		}
	}
	if (BrLock==NULL) {
		BrLock = lock_create("BrLock");
		if (BrLock == NULL) {
			panic("BrLock: lock_create failed\n");
		}
	}
	if (boyCV==NULL) {
		boyCV = cv_create("boyCV");
		if (boyCV == NULL) {
			panic("boyCV: cv_create failed\n");
		}
	}
	if (girlCV==NULL) {
		girlCV = cv_create("girlCV");
		if (girlCV == NULL) {
			panic("girlCV: cv_create failed\n");
		}
	}
}
Example #3
0
int
elves(int nargs, char **args)
{
	unsigned num_elves;

	// if an argument is passed, use that as the number of elves
	num_elves = 10;
	if (nargs == 2) {
		num_elves = atoi(args[1]);
	}

	// Suppress unused warnings. Remove these when finished.
	(void) work;
	(void) supervisor;
	(void) elf;
    (void) num_elves;
	// TODO

	print_lock = sem_create("print", 1);
	elf_lock = sem_create("elf", num_elves);
	complete_lock = sem_create("complete_lk", 1);
	elf_complete = -1;

	kprintf("Starting up Keebler Factory!\n");
	supervisor(NULL, num_elves);

	return 0;
}
Example #4
0
/*
 * Setup routine called by autoconf.c when an lhd is found.
 */
int
config_lhd(struct lhd_softc *lh, int lhdno)
{
	char name[32];

	/* Figure out what our name is. */
	snprintf(name, sizeof(name), "lhd%d", lhdno);

	/* Get a pointer to the on-chip buffer. */
	lh->lh_buf = bus_map_area(lh->lh_busdata, lh->lh_buspos, LHD_BUFFER);

	/* Create the semaphores. */
	lh->lh_clear = sem_create("lhd-clear", 1);
	if (lh->lh_clear == NULL) {
		return ENOMEM;
	}
	lh->lh_done = sem_create("lhd-done", 0);
	if (lh->lh_done == NULL) {
		sem_destroy(lh->lh_clear);
		lh->lh_clear = NULL;
		return ENOMEM;
	}

	/* Set up the VFS device structure. */
	lh->lh_dev.d_ops = &lhd_devops;
	lh->lh_dev.d_blocks = bus_read_register(lh->lh_busdata, lh->lh_buspos,
						LHD_REG_NSECT);
	lh->lh_dev.d_blocksize = LHD_SECTSIZE;
	lh->lh_dev.d_data = lh;

	/* Add the VFS device structure to the VFS device list. */
	return vfs_adddev(name, &lh->lh_dev, 1);
}
Example #5
0
static
void
inititems(void)
{
	if (testsem==NULL) {
		testsem = sem_create("testsem", 2);
		if (testsem == NULL) {
			panic("synchtest: sem_create failed\n");
		}
	}
	if (testlock==NULL) {
		testlock = lock_create("testlock");
		if (testlock == NULL) {
			panic("synchtest: lock_create failed\n");
		}
	}
	if (testcv==NULL) {
		testcv = cv_create("testlock");
		if (testcv == NULL) {
			panic("synchtest: cv_create failed\n");
		}
	}
	if (donesem==NULL) {
		donesem = sem_create("donesem", 0);
		if (donesem == NULL) {
			panic("synchtest: sem_create failed\n");
		}
	}
}
Example #6
0
void createSemaphores(void) {
	sem_create(smutex, 1);
	sem_create(sage, 0);
	sem_create(stob, 0);
	sem_create(spap, 0);
	sem_create(smat, 0);

}
Example #7
0
static struct pipefs_vnode *pipefs_create_vnode(struct pipefs *fs, const char *name, stream_type type)
{
	struct pipefs_vnode *v;

	v = kmalloc(sizeof(struct pipefs_vnode));
	if(v == NULL)
		return NULL;

	memset(v, 0, sizeof(struct pipefs_vnode));
	v->id = atomic_add(&fs->next_vnode_id, 1);

	v->name = kstrdup(name);
	if(v->name == NULL)
		goto err;

	v->stream.type = type;
	switch(type) {
		case STREAM_TYPE_DIR:
			v->stream.u.dir.dir_head = NULL;
			v->stream.u.dir.jar_head = NULL;
			if(mutex_init(&v->stream.u.dir.dir_lock, "pipefs_dir_lock") < 0)
				goto err;
			break;
		case STREAM_TYPE_PIPE:
			v->stream.u.pipe.buf = kmalloc(PIPE_BUFFER_LEN);
			if(v->stream.u.pipe.buf == NULL)
				goto err;
			v->stream.u.pipe.buf_len = PIPE_BUFFER_LEN;

			if(mutex_init(&v->stream.u.pipe.lock, "pipe_lock") < 0) {
				kfree(v->stream.u.pipe.buf);
				goto err;
			}
			v->stream.u.pipe.read_sem = sem_create(0, "pipe_read_sem");
			if(v->stream.u.pipe.read_sem < 0) {
				mutex_destroy(&v->stream.u.pipe.lock);
				kfree(v->stream.u.pipe.buf);
				goto err;
			}
			v->stream.u.pipe.write_sem = sem_create(1, "pipe_write_sem");
			if(v->stream.u.pipe.write_sem < 0) {
				sem_delete(v->stream.u.pipe.read_sem);
				mutex_destroy(&v->stream.u.pipe.lock);
				kfree(v->stream.u.pipe.buf);
				goto err;
			}
			break;
	}

	return v;

err:
	if(v->name)
		kfree(v->name);
	kfree(v);
	return NULL;
}
Example #8
0
void whalemating_init() {
 hold=lock_create("My lock");
 male_sem=sem_create("Male Semaphore",0);
 female_sem=sem_create("Female Semaphore",0);
mate_cv=cv_create("mating cv");
male_count=0;
female_count=0;
  return;
}
Example #9
0
int
config_con(struct con_softc *cs, int unit)
{
	struct semaphore *rsem, *wsem;
	struct lock *rlk, *wlk;

	/*
	 * Only allow one system console.
	 * Further devices that could be the system console are ignored.
	 *
	 * Do not hardwire the console to be "con1" instead of "con0",
	 * or these asserts will go off.
	 */
	if (unit>0) {
		KASSERT(the_console!=NULL);
		return ENODEV;
	}
	KASSERT(the_console==NULL);

	rsem = sem_create("console read", 0);
	if (rsem == NULL) {
		return ENOMEM;
	}
	wsem = sem_create("console write", 1);
	if (wsem == NULL) {
		sem_destroy(rsem);
		return ENOMEM;
	}
	rlk = lock_create("console-lock-read");
	if (rlk == NULL) {
		sem_destroy(rsem);
		sem_destroy(wsem);
		return ENOMEM;
	}
	wlk = lock_create("console-lock-write");
	if (wlk == NULL) {
		lock_destroy(rlk);
		sem_destroy(rsem);
		sem_destroy(wsem);
		return ENOMEM;
	}

	cs->cs_rsem = rsem;
	cs->cs_wsem = wsem;
	cs->cs_gotchars_head = 0;
	cs->cs_gotchars_tail = 0;

	the_console = cs;
	con_userlock_read = rlk;
	con_userlock_write = wlk;

	flush_delay_buf();

	return attach_console_to_vfs(cs);
}
void stoplight_init() {

  for(int i=0; i<DIRECTIONS;i++)
  {
    if(quadSem[i]==NULL){
      quadSem[i] = sem_create("Quadrant Semaphore",1);
      if (quadSem[i] == NULL) {
        panic("synchtest: sem_create failed at quadSem\n");
      }
    }
  }

  if(mutex==NULL){
	  mutex = sem_create("mutex Semaphore",1);
        if (mutex == NULL) {
          panic("synchtest: sem_create failed at quadSem\n");
        }
      }
  j[0]=0;
  j[1]=0;
  j[2]=0;
  j[3]=0;
  head[0]=1;
  head[1]=1;
  head[2]=1;
  head[3]=1;

  jlock=lock_create("j1lock");
  /*jl[1]=lock_create("j2lock");
  jl[2]=lock_create("j3lock");
  jl[3]=lock_create("j4lock");
*/
/*  if(quadSem1==NULL){
    quadSem1 = sem_create("Quadrant 1 Semaphore",0);
    if (quadSem1 == NULL) {
      panic("synchtest: sem_create failed at quadSem1\n");
    }
  }
  if(quadSem2==NULL){
    quadSem2 = sem_create("Quadrant 2 Semaphore",0);
    if (quadSem2 == NULL) {
      panic("synchtest: sem_create failed at quadSem2\n");
    }
  }
  if(quadSem3==NULL){
    quadSem3 = sem_create("Quadrant 3 Semaphore",0);
    if (quadSem3 == NULL) {
      panic("synchtest: sem_create failed at quadSem3\n");
    }
  }
*/
  return;
}
Example #11
0
qsem_t *qsem_create (int count)
{
	qsem_t *s;

	s = (qsem_t *) malloc (sizeof (qsem_t));
#ifdef I386
	s->mutex = sem_create (count, "qsem_mutex");
	s->count = 0;
#else
	s->mutex = sem_create (0, "qsem_mutex");
	s->count = count;
#endif
	return s;
}
Example #12
0
void test161_bootstrap()
{
	test161_sem = sem_create("test161", 1);
	if (test161_sem == NULL) {
		panic("Failed to create test161 secprintf semaphore");
	}
}
Example #13
0
int
kmallocstress(int nargs, char **args)
{
	struct semaphore *sem;
	int i, result;

	(void)nargs;
	(void)args;

	sem = sem_create("kmallocstress", 0);
	if (sem == NULL) {
		panic("kmallocstress: sem_create failed\n");
	}

	kprintf("Starting kmalloc stress test...\n");

	for (i=0; i<NTHREADS; i++) {
		result = thread_fork("kmallocstress", NULL,
				     kmallocthread, sem, i);
		if (result) {
			panic("kmallocstress: thread_fork failed: %s\n",
			      strerror(result));
		}
	}

	for (i=0; i<NTHREADS; i++) {
		P(sem);
	}

	sem_destroy(sem);
	kprintf("\n");
	success(TEST161_SUCCESS, SECRET, "km2");

	return 0;
}
static
void
initiateMating()
{
	if (mateLock==NULL) {
		mateLock = lock_create("mateLock");
		if (mateLock == NULL) {
			panic("mateLock: lock_create failed\n");
		}
	}
	if (male_go==NULL) {
		male_go = cv_create("male_go");
		if (male_go == NULL) {
			panic("male_go: cv_create failed\n");
		}
	}
	if (female_go==NULL) {
		female_go = cv_create("female_go");
		if (female_go == NULL) {
			panic("female_go: cv_create failed\n");
		}
	}
	if (matchmaker_go==NULL) {
		matchmaker_go = cv_create("matchmaker_go");
		if (matchmaker_go == NULL) {
			panic("matchmaker_go: cv_create failed\n");
		}
	}
	if (doneSem==NULL) {
		doneSem = sem_create("doneSem", 0);
		if (doneSem == NULL) {
			panic("doneSem: sem_create failed\n");
		}
	}
}
Example #15
0
gpointer
ves_icall_System_Threading_Semaphore_CreateSemaphore_internal (gint32 initialCount, gint32 maximumCount, MonoString *name, gint32 *error)
{ 
	gpointer sem;

	if (maximumCount <= 0) {
		mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: maximumCount <= 0", __func__);

		*error = ERROR_INVALID_PARAMETER;
		return NULL;
	}

	if (initialCount > maximumCount || initialCount < 0) {
		mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: initialCount > maximumCount or < 0", __func__);

		*error = ERROR_INVALID_PARAMETER;
		return NULL;
	}

	/* Need to blow away any old errors here, because code tests
	 * for ERROR_ALREADY_EXISTS on success (!) to see if a
	 * semaphore was freshly created
	 */
	SetLastError (ERROR_SUCCESS);

	if (!name)
		sem = sem_create (initialCount, maximumCount);
	else
		sem = namedsem_create (initialCount, maximumCount, mono_string_chars (name));

	*error = GetLastError ();

	return sem;
}
Example #16
0
struct rwlock * rwlock_create(const char *name){

	struct rwlock *myrwlock;

	myrwlock=kmalloc(sizeof(struct rwlock));

	if(myrwlock==NULL){
		return NULL;
	}

	myrwlock->rwlock_name = kstrdup(name);

	if(myrwlock->rwlock_name==NULL){
		kfree(myrwlock);
		return NULL;
	}

	myrwlock->lk_read=lock_create("read");
	myrwlock->lk_write=lock_create("write");
	myrwlock->max_readers=30;
	myrwlock->sem_resource=sem_create("resource",myrwlock->max_readers);


	if(myrwlock->sem_resource==NULL){
		kfree(myrwlock);
		return NULL;
	}

	return myrwlock;
}
Example #17
0
// pub pipe lock
void pipe_lock()
{
  if (sem_pipe < 0) {
    if ( (sem_pipe = sem_create(SEMKEY_PIPE, 1)) < 0) err_sys("sem_create error for pipe lock");
  }
  sem_wait(sem_pipe);
}
Example #18
0
/* Initialize driver; note that this replaces the AICA program so that
   if you had anything else going on, it's gone now! */
int snd_init() {
	int amt;

	/* Finish loading the stream driver */
	if (!initted) {
		spu_disable();
		spu_memset(0, 0, AICA_RAM_START);
		amt = snd_stream_drv_end - snd_stream_drv;
		if (amt % 4)
			amt = (amt + 4) & ~3;
		printf("snd_init(): loading %d bytes into SPU RAM\n", amt);
		spu_memload(0, snd_stream_drv, amt);

		/* Enable the AICA and give it a few ms to start up */
		spu_enable();
		timer_spin_sleep(10);

		/* Initialize the RAM allocator */
		snd_mem_init(AICA_RAM_START);

		/* Setup semaphores */
		sem_qram = sem_create(1);
	}

	initted = 1;
	
	return 0;
}
Example #19
0
struct rwlock *
rwlock_create(const char *name)
{
	struct rwlock *rw;

	rw = kmalloc(sizeof(rw));
	if(rw==NULL){
		return NULL;
	}

	rw->rwlock_name=kstrdup(name);
	if(rw->rwlock_name==NULL){
		kfree(rw);
		return NULL;
	}


	//Create Semaphore
	rw->rwlock_semaphore = sem_create(rw->rwlock_name,MAX_READ);
	if (rw->rwlock_semaphore == NULL) {
			kfree(rw->rwlock_name);
			kfree(rw);
			return NULL;
	}
	//rw->read_count=0;
	//Create Lock
	rw->rwlock_lock=lock_create(rw->rwlock_name);
   	if (rw->rwlock_lock == NULL) {
   		kfree(rw->rwlock_name);
   		kfree(rw);
	    return NULL;
	}

	return rw;
}
Example #20
0
int main(void)
{
	int freie_ressourcen;

	/* Anlegen des Semaphors */
	sem_anfordid = sem_create(SEM_READKEY);
	

	/* Setzen des Sempahors auf 1 */
	sem_set(sem_anfordid, 1);


	/* Beginn Serverschleife */
	while(1) {
		
		/* Abfragen wieviel Ressourcen frei sind, falls 0 Schleife verlassen */
		freie_ressourcen = sem_get(sem_anfordid);
		if (freie_ressourcen == 0)
			break;
		
		/* eine Sekunde warten */
		sleep(1);
		
	/* Ende Serverschleife */
	}
	
	/* Semaphor entfernen */
	sem_rm(sem_anfordid);

	printf("Server terminiert.\n");
	exit(0);
}
Example #21
0
/* 
 * The simulation driver will call this function once before starting
 * the simulation
 *
 * You can use it to initialize synchronization and other variables.
 * 
 */
void
intersection_sync_init(void)
{
  /* replace this default implementation with your own implementation */
	
	inservice=0;
	wait_total=0;
  intersectionSem = sem_create("intersectionSem",1);
  if (intersectionSem == NULL) {
    panic("could not create intersection semaphore");
  }
  mutex=lock_create("intersection lock");
  if(mutex==NULL)
  {
  	panic("could not create intersection lock");
  }
  int i;
  for(i=0;i<4;i++)
  {
  	CV[i]=cv_create("condition varaible");
  	if(CV[i]==NULL)
  	{
  		panic("could not create condition variable");
  	}
  }
  return;
}
Example #22
0
static dma_chain_t * alloc_chain()
{
  static int init;
  dma_chain_t * res;

  spinlock_lock(&mutex);

  if (!init) {
    int i;
    for (i=0; i<BUFSZ; i++) {
      buf[i].sema = sem_create(0);
      buf[i].next = (i<BUFSZ-1)? buf+i+1 : NULL;
    }
    free_head = buf;
    init = 1;
  }

  res = free_head;
  if (res) {
    free_head = res->next;
    res->next = NULL;
  } else
    panic("running out of dma chain structure !\n");
  spinlock_unlock(&mutex);
  return res;
}
Example #23
0
File: bowls.c Project: cozos/os161
/*
 * initialize_bowls()
 * 
 * Purpose:
 *   initializes simulation of cats and mice and bowls
 *
 * Arguments:
 *   unsigned int bowlcount:  the number of food bowls to simulate
 *
 * Returns:
 *   0 on success, 1 otherwise
 */
int
initialize_bowls(unsigned int bowlcount)
{
  unsigned int i;

  if (bowlcount == 0) {
    kprintf("initialize_bowls: invalid bowl count %d\n",bowlcount);
    return 1;
  }

  bowls = kmalloc(bowlcount*sizeof(char));
  if (bowls == NULL) {
    panic("initialize_bowls: unable to allocate space for %d bowls\n",bowlcount);
  }
  /* initialize bowls */
  for(i=0;i<bowlcount;i++) {
    bowls[i] = '-';
  }
  eating_cats_count = eating_mice_count = 0;
  num_bowls = bowlcount;

  /* intialize mutex semaphore */
  mutex = sem_create("bowl mutex",1);
  if (mutex == NULL) {
    panic("initialize_bowls: sem_create failed\n");
  }
  
  return 0;
}
Example #24
0
int el_loader_init(void)
{
  PRINTF("entrylist_load_init...\n");

  spinlock_init(&loader_mutex);
  memset(&loader, 0, sizeof(loader));
  loader_status = LOADER_INIT;
  loader_thd = 0;
  PRINTF("entrylist_load_init : create semaphore.\n");
  loader_sem = sem_create(1);
  PRINTF("entrylist_load_init : semaphore [%p].\n",loader_sem);
  if (!loader_sem) {
    printf("entrylist_load_init : can not create semaphore.\n");
    return -1;
  }
  PRINTF("entrylist_load_init : first wait semaphore.\n");
  sem_wait(loader_sem);

  PRINTF("entrylist_load_init : create thread.\n");
  loader_thd = thd_create(THD_DEFAULTS, loader_thread, loader_sem);
  if (!loader_thd) {
    printf("entrylist_load_init : thread failed.\n");
    sem_signal(loader_sem);
    sem_destroy(loader_sem);
    loader_sem = 0;
    printf("entrylist_load_init : can not create loader thread.\n");
    return -1;
  }
  PRINTF("entrylist_load_init : thread created, rename it.\n");
  thd_set_label((kthread_t *)loader_thd, "Loader-thd");
  PRINTF("entrylist_load_init : complete (thd=%p).\n", loader_thd);
  return 0;
}
Example #25
0
int id_gen_test(int nargs, char **args){
	sem_numthread = sem_create("sem_testidgen",0);
	struct spinlock splock;
	spinlock_init(&splock);
	idgen = idgen_create(0);

	KASSERT(idgen != NULL);

	(void)nargs;
	(void)args;

	const int NUMTHREAD = 3;

	int i = 0;
	for (; i < NUMTHREAD; i++){
		kprintf ("MAKING THREAD %d\n", i);
		thread_fork("id_gen_test", NULL, test_generator, NULL, i);
	}

	for (int j = 0; j < NUMTHREAD; j++,i++){
		kprintf ("MAKING THREAD %d\n", i);
		thread_fork("id_gen_test", NULL, test_generator2, NULL, i);
	}

	for (int j = 0; j < 2*NUMTHREAD; j++){
		P(sem_numthread);
	}

	idgen_destroy(idgen);
	sem_destroy(sem_numthread);
	return 0;
}
Example #26
0
// conn lock
void conn_lock()
{
  if (sem_conn < 0) {
    if ( (sem_conn = sem_create(SEMKEY_CONNECT, 1)) < 0) err_sys("sem_create error for connection lock");
  }
  sem_wait(sem_conn);
}
/*
 * Start up secondary cpus. Called from boot().
 */
void
thread_start_cpus(void)
{
    char buf[64];
    unsigned i;

    cpu_identify(buf, sizeof(buf));
    kprintf("cpu0: %s\n", buf);

    cpu_startup_sem = sem_create("cpu_hatch", 0);
    thread_count_wchan = wchan_create("thread_count");
    mainbus_start_cpus();

    num_cpus = cpuarray_num(&allcpus);
    for (i=0; i<num_cpus - 1; i++) {
        P(cpu_startup_sem);
    }
    sem_destroy(cpu_startup_sem);
    if (i == 0) {
        kprintf("1 CPU online\n");
    } else {
        kprintf("%d CPUs online\n", i + 1);
    }
    cpu_startup_sem = NULL;

    // Gross hack to deal with os/161 "idle" threads. Hardcode the thread count
    // to 1 so the inc/dec properly works in thread_[fork/exit]. The one thread
    // is the cpu0 boot thread (menu), which is the only thread that hasn't
    // exited yet.
    thread_count = 1;
}
Example #28
0
int
coremapstress(int nargs, char **args)
{
	struct semaphore *sem;
	int i, err;

	(void)nargs;
	(void)args;

	sem = sem_create("coremapstress", 0);
	if (sem == NULL) {
		panic("coremapstress: sem_create failed\n");
	}

	kprintf("Starting kcoremap stress test...\n");

	for (i=0; i<NTHREADS; i++) {
		err = thread_fork("coremapstress", coremapthread, sem, i,
				  NULL);
		if (err) {
			panic("coremapstress: thread_fork failed (%d)\n", err);
		}
	}

	for (i=0; i<NTHREADS; i++) {
		P(sem);
	}

	sem_destroy(sem);
	kprintf("kcoremap stress test done\n");

	return 0;
}
Example #29
0
int
main() {
	sem_t sem;
	struct s a, b, c, d;
    int tid1;
    int tid2;
    int tid3;
    int tid4;
	sem = sem_create("usersem test", 1);
	a.sem = &sem; a.c = 'a';
	b.sem = &sem; b.c = 'b';
	c.sem = &sem; c.c = 'c';
	d.sem = &sem; d.c = 'd';
    tid1 = UserThreadCreate(SimpleThread, (void*) &a);
    tid2 = UserThreadCreate(SimpleThread, (void*) &b);
    tid3 = UserThreadCreate(SimpleThread, (void*) &c);
    tid4 = UserThreadCreate(SimpleThread, (void*) &d);

    UserThreadJoin(tid1);
    UserThreadJoin(tid2);
    UserThreadJoin(tid3);
    UserThreadJoin(tid4);
	sem_destroy(sem);

	return 0;
}
Example #30
0
void
initialize_pid(struct thread *thr,pid_t processid)
{
	if(curthread!=NULL)
		lock_acquire(pid_lock);
	struct process_control *p_array;

	p_array=kmalloc(sizeof(struct process_control));

	thr->t_pid=processid;

	p_array->parent_id=-1;
	p_array->childlist=NULL;
	p_array->exit_code=-1;
	p_array->exit_status=false;
	p_array->mythread=thr;
	p_array->waitstatus=false;
	p_array->process_sem = sem_create(thr->t_name,0);

	//Create the lock and CV
	p_array->process_lock=lock_create(thr->t_name);
	p_array->process_cv = cv_create(thr->t_name);

	//Copy back into the thread
	process_array[processid]=p_array;

	if(curthread!=NULL)
		lock_release(pid_lock);

}