void finalizeMemory() { if (!_initialized) return; DescriptorNode * node; while (_usedCount--) { node = _usedList; removeFromList(node, &_usedList); free(node->value); free(node); } while (_freeCount--) { node = _freeList; removeFromList(node, &_freeList); free(node->value); free(node); } free(_entry); _minFreeSize = INT_MAX; _maxFreeSize = 0; _initialized = 0; _totalFreeSize = 0; }
void dfree(void* ptr) { metadata_t* myHead = (metadata_t*) (((void*)(ptr)) - METADATA_T_ALIGNED); //front of header foot_t* myFoot = (foot_t*) (((void*)(ptr)) + myHead->size);//footer metadata_t* prevHead = NULL; foot_t* prevFoot = (foot_t*) (((void*)(ptr)) - FOOT_T_ALIGNED - METADATA_T_ALIGNED); metadata_t* nextHead = (metadata_t*) (((void*)(myFoot)) + FOOT_T_ALIGNED); foot_t* nextFoot = NULL; bool prevFree = false; bool nextFree = false; //Check if prev block can be coalesced if(prevFoot >= (foot_t*) slabStart){ prevHead = (metadata_t*) (((void*)(ptr)) - FOOT_T_ALIGNED - prevFoot->size - 2*METADATA_T_ALIGNED); if(prevHead->next != (void*) -1){ //If prev is free prevFree = true; removeFromList(prevHead,convertToIndex(prevHead->size)); } } //Check if next block can be coalesced if(nextHead < (metadata_t*) slabEnd){ nextFoot = (foot_t*) (((void*)(nextHead)) + nextHead->size + METADATA_T_ALIGNED); if(nextHead->next != (void*) -1){ //If next is free nextFree = true; removeFromList(nextHead,convertToIndex(nextHead->size)); } } //Start coalescing prev if(prevFree){ prevHead->size = prevHead->size + myHead->size + METADATA_T_ALIGNED + FOOT_T_ALIGNED; myFoot->size = prevHead->size; myHead = prevHead; } //Start coalescing next if(nextFree){ myHead->size = myHead->size + nextHead->size + METADATA_T_ALIGNED + FOOT_T_ALIGNED; nextFoot->size = myHead->size; } //Put into appropriate freelist block int index = convertToIndex(myHead->size); myHead->next = blocks[index]; blocks[index] = myHead; myHead->prev = NULL; if(myHead->next != NULL){ myHead->next->prev = myHead; } }
void deleteList(List *myList){ while (myList->head->next != nullptr){ removeFromList(myList->head); } delete myList->head; delete myList; }
/* ioUnloadModule: Unload the module with the given name. */ sqInt ioUnloadModule(const char *moduleName) { ModuleEntry *entry, *temp; if(!squeakModule) return 0; /* Nothing has been loaded */ if(!moduleName || !moduleName[0]) return 0; /* nope */ entry = findLoadedModule(moduleName); if(!entry) return 1; /* module was never loaded */ /* Try to shutdown the module */ if(!shutdownModule(entry)) { /* Could not shut down the module. Bail out. */ return 0; } /* Notify all interested parties about the fact */ temp = firstModule; while(temp) { if(temp != entry) { /* Lookup moduleUnloaded: from the plugin */ void *fn = findFunctionIn("moduleUnloaded", temp); if(fn) { /* call it */ ((sqInt (*) (char *))fn)(entry->name); } } temp = temp->next; } /* And actually unload it if it isn't just the VM... */ if(entry->handle != squeakModule->handle) ioFreeModule(entry->handle); removeFromList(entry); free(entry); /* give back space */ return 1; }
int P1_V(P1_Semaphore sem){ // USLOSS_Console("In P1_V for %s\n",procTable[currPid].name); Check_Your_Privilege(); // interrupt disable HERE! int_disable(); Semaphore* semP=(Semaphore*)sem; // check if the semaphore is valid if(semP==NULL||semP->valid<0){ USLOSS_Console("Semaphore is invalid\n"); return - 1; } semP->value++; if(currPid!=-1&&semP->queue->nextPCB != NULL){ // USLOSS_Console("In P1_V for %s\n",procTable[currPid].name); int PID=semP->queue->nextPCB->PID; // USLOSS_Console("P1_V Pid: %d",PID); //Move first frocess from procQueue to ready queue // if(procTable[PID].state == 4){ procTable[PID].state = 1; // ready status procTable[currPid].waitingOnDevice=0; //removeToProcQue(currPid,*semP); removeFromList(PID); addToReadyList(PID); // USLOSS_Console("ReadyList after P1_V for %s: ",procTable[PID].name); // printList(&readyHead); dispatcher(); // } } int_enable(); // interrupt enable HERE! return 0; }
void AllTaluka::removeTaluka(QString taluka, QString district){ if(query->exec(db->getDeleteTalukaQuery(taluka, district))){ removeFromList(taluka, district); }else{ qDebug() << "Could not delete Taluka"; } }
/* findAndLoadModule: Find the module with the given name by, * first looking it up in some (external) shared library * then, by trying to find pluginName_setInterpreter. If the module is found and the initialisers work, add it to the list of loaded modules and return the new module. If anything goes wrong make sure the module is unloaded (WITHOUT calling shutdownModule()) and return NULL. */ static ModuleEntry *findAndLoadModule(char *pluginName, int ffiLoad) { void *handle; ModuleEntry *module; dprintf(("Looking for plugin %s\n", (pluginName ? pluginName : "<intrinsic>"))); /* Try to load the module externally */ handle = ioLoadModule(pluginName); if(ffiLoad) { /* When dealing with the FFI, don't attempt to mess around internally */ if(!handle) return NULL; return addToModuleList(pluginName, handle, ffiLoad); } /* NOT ffiLoad */ if(!handle) { /* might be internal, so go looking for setInterpreter() */ if(findInternalFunctionIn("setInterpreter", pluginName)) handle = squeakModule->handle; else return NULL; /* PluginName_setInterpreter() not found */ } module = addToModuleList(pluginName, handle, ffiLoad); if(!callInitializersIn(module)) { /* Initializers failed */ if(handle != squeakModule->handle) { /* physically unload module */ ioFreeModule(handle); } removeFromList(module); /* remove list entry */ free(module); /* give back space */ module = NULL; } return module; }
//处理超时的Event static void processTimeouts() { dlog("~~~~ +processTimeouts ~~~~"); MUTEX_ACQUIRE(); struct timeval now; struct ril_event * tev = timer_list.next; struct ril_event * next; getNow(&now); // walk list, see if now >= ev->timeout for any events dlog("~~~~ Looking for timers <= %ds + %dus ~~~~", (int)now.tv_sec, (int)now.tv_usec); // 如果timer_list中某个事件已经超时 while ((tev != &timer_list) && (timercmp(&now, &tev->timeout, >))) { // Timer expired dlog("~~~~ firing timer ~~~~"); next = tev->next; // 从timer_list中删除 removeFromList(tev); // 添加到pending_list中 addToList(tev, &pending_list); tev = next; }
int myfree(void * blockPtr) { if (!_initialized) return -1; DescriptorNode * node = findDescriptor(blockPtr, _usedList); //printf("Chunk to free: blocks=%d, ptr=%d\n", node->value->blockCount, node->value->memory); size_t nodeSize = node->value->blockCount * (BLOCK_SIZE << 10); if (node == NULL) return 0; removeFromList(node, &_usedList); pushFront(node, &_freeList); _usedCount--; _freeCount++; _totalFreeSize += nodeSize; if (nodeSize < _minFreeSize) _minFreeSize = nodeSize; if (nodeSize > _maxFreeSize) _maxFreeSize = nodeSize; return 1; }
int test(){ T t ; t.x =1; t.y =2; T t1 = {3,4}; Find f =&find; ListPtr list = initList(NULL,NULL); insertToList(list, &t, sizeof(t)); insertToList(list, &t1, sizeof(t1)); int a =1; void*args[0]; args[0]=&a; T* s = getFromList(list,f,args); //printf("%d %d\n", s->y, t.y); insertToList(list, &t1,sizeof(t1)); insertToList(list, &t1,sizeof(t1)); insertToList(list, &t1,sizeof(t1)); insertToList(list, &t1,sizeof(t1)); insertToList(list, &t1,sizeof(t1)); a = 1; T* r = getFromList(list,f,args); printf("%d\n", r->y); printf("count %d\n", getCount(list)); displayList(list,display,4); printf("remove %d\n",removeFromList(list,f,args)); displayList(list,display,4); r = getFromList(list,f,args); //printf("%d\n", r); assert(r==NULL); displayList(list,display,4); t1.y=10; a = 3; int count = setToList(list,&t1,sizeof(t1),f,args); printf("update %d\n", count); displayList(list,display,4); ListPtr ptr = list; int i = 0; do{ void * data = NULL; if(i>4){ data= preFromList(&ptr,list,f,args); }else{ data = nextFromList(&ptr,list,f,args); } if(ptr != list){ display(data,ptr->id); printf("\n"); } i++; }while(ptr!=list); //displayList(list,display,4); int num = freeList(&list); printf("%d\n", num); }
/*Removes a pcb from procTable*/ void removeProc(int PID){ //USLOSS_Console("Removing PCB %d\n",PID); if(procTable[PID].priority == -1){ return; } procTable[PID].priority = -1; /*Remove from quit list*/ removeFromList(PID); }
void SpriteBody::update(float dt) { if(isDelete){ destroyBody(*Engine::world); removeFromList(Engine::bodylist); removeFromList(Engine::effectslist); return; } m_animation.getSprite().setRotation( default_rotation + 180.f*m_body->GetAngle()/(M_PI) ); m_animation.getSprite().setPosition( m_body->GetPosition().x*pixelsPerMeter, m_body->GetPosition().y*pixelsPerMeter); m_animation.update(dt); //m_sprite.setRotation( 180.f*m_body->GetAngle()/(M_PI) ); //m_sprite.setPosition( m_body->GetPosition().x*pixelsPerMeter, m_body->GetPosition().y*pixelsPerMeter); }
TASK_DLLEXPORT int Task_wait_read(int fd, long msec) { Task *tp; struct timeval tv; fd_set set; int r; if (!canSwitch) { FD_ZERO(&set); FD_SET(fd, &set); calcTv(&tv, msec); r = t_select(FD_SETSIZE, &set, 0, 0, &tv); if (r > 0) return 0; else if (r == 0) return 1; else return r; } tp = currTask; FD_ZERO(&set); FD_SET(fd, &set); tv.tv_sec = tv.tv_usec = 0; r = t_select(FD_SETSIZE, &set, 0, 0, &tv); if (r != 0) { Task_yield(); if (r > 0) return 0; else return r; } FD_ZERO(&tp->rfileset); FD_SET(fd, &tp->rfileset); tp->wakeUp = calcWakeup(msec); removeFromList(tp); tp->isRead = 1; addToWait(tp); tp->isTimed = 0; Task_yield(); tp->isRead = 0; return tp->isTimed; }
void METH(remove)(hList listHandle, t_list_link *pElem) { t_list_imp *pList = (t_list_imp *) listHandle; if (pList->mutex) {eeMutexLock(pList->mutex);} removeFromList(pList, pElem); if (pList->mutex) {eeMutexUnlock(pList->mutex);} }
bool LRUCache::Remove(const char* key) { void* p; if (!v.Lookup(key, p)) return false; VarEntry* e = (VarEntry*) p; v.Remove(key); removeFromList(e); delete[] e->key; delete e; return true; }
// This function is called when a /dev/osprdX file is finally closed. // (If the file descriptor was dup2ed, this function is called only when the // last copy is closed.) static int osprd_close_last(struct inode *inode, struct file *filp) { if (filp) { osprd_info_t *d = file2osprd(filp); int filp_writable = filp->f_mode & FMODE_WRITE; // EXERCISE: If the user closes a ramdisk file that holds // a lock, release the lock. Also wake up blocked processes // as appropriate. // Your code here. osp_spin_lock(&(d->mutex)); if (!pidInList(d->writeLockingPids, current->pid) && !(pidInList(d->readLockingPids, current->pid))) { osp_spin_unlock(&(d->mutex)); return -EINVAL; } if (pidInList(d->writeLockingPids, current->pid)) { removeFromList(&(d->writeLockingPids), current->pid); } if (pidInList(d->readLockingPids, current->pid)) { removeFromList(&(d->readLockingPids), current->pid); } if (d->readLockingPids == NULL && d->writeLockingPids == NULL) { filp->f_flags &= !F_OSPRD_LOCKED; } osp_spin_unlock(&(d->mutex)); wake_up_all(&(d->blockq)); // This line avoids compiler warnings; you may remove it. (void) filp_writable, (void) d; } return 0; }
// This function is called when a /dev/osprdX file is finally closed. // (If the file descriptor was dup2ed, this function is called only when the // last copy is closed.) static int osprd_close_last(struct inode *inode, struct file *filp) { if (filp) { osprd_info_t *d = file2osprd(filp); if (d == NULL) return 1; osp_spin_lock(&(d->mutex)); // If the file hasn't locked the ramdisk, return -EINVAL if (!pidInList(d->writeLockingPids, current->pid) && !(pidInList(d->readLockingPids, current->pid))) { osp_spin_unlock(&(d->mutex)); return -EINVAL; } if (pidInList(d->writeLockingPids, current->pid)) { removeFromList(&d->writeLockingPids, current->pid); } if (pidInList(d->readLockingPids, current->pid)) { removeFromList(&d->readLockingPids, current->pid); } // Clear the lock from filp->f_flags if no processes (not just current process) hold any lock. if (d->readLockingPids == NULL && d->writeLockingPids == NULL) { filp->f_flags &= !F_OSPRD_LOCKED; } osp_spin_unlock(&(d->mutex)); wake_up_all(&(d->blockq)); } return 0; }
/* * CS186: Called when the specified buffer is unpinned and becomes * available for replacement. */ void BufferUnpinned(int bufIndex) { volatile BufferDesc *buf = &BufferDescriptors[bufIndex]; //lock the buffer? if (!LWLockConditionalAcquire(BufFreelistLock, LW_EXCLUSIVE)) return; /* * CS186 TODO: When this function is called, the specified buffer has * just been unpinned. That means you can start to manage this buffer * using your buffer replacement policy. You can access the * StrategyControl global variable from inside this function. * This function was added by the GSIs. */ if(BufferReplacementPolicy == POLICY_2Q){ if(buf->inList == true){ removeFromList(buf); addToList(buf); } else if(buf->inA1 == true){ removeFromA1(buf); addToList(buf); } else{ addToA1(buf); } } else{ if(buf->inList == true){ removeFromList(buf); } addToList(buf); } LWLockRelease(BufFreelistLock); }
static struct block * split(struct block * freeBlock, int newBlockSize) { struct block * usedBlock = NULL; TRACE("Shrinking free block by 0x%zx bytes\n",newBlockSize+sizeof(struct block)); if (freeBlock->size<newBlockSize+sizeof(struct block)) { TRACE("Free block %p is too small to shrink,\ move it to used linked list instead\n",freeBlock); removeFromList(freeBlock); TRACE("firstUsedBlock : %p\n",firstUsedBlock); freeBlock->next=firstUsedBlock; //Add it in front of used block list freeBlock->prev=NULL; firstUsedBlock->prev=freeBlock; firstUsedBlock=freeBlock; return freeBlock; }
// First Fit Implementation // metadata_t* firstFitblock(size_t numbytes,int index) { int i; for(i=index;i<10;i++){ if(blocks[i] != NULL){ metadata_t* itr = blocks[i]; while(itr != NULL){ if(itr->size >= numbytes){ removeFromList(itr,i); return itr; } itr = itr->next; } } } return NULL; }
void HReturnStatement::keyPressEvent(Visualization::Item *target, QKeyEvent *event) { auto vret = dynamic_cast<OOVisualization::VReturnStatement*> ( target ); event->ignore(); bool symbolHasFocus = vret->returnSymbol()->itemOrChildHasFocus(); if (event->modifiers() == Qt::NoModifier && (event->key() == Qt::Key_Backspace || (event->key() == Qt::Key_Delete && symbolHasFocus))) { event->accept(); removeFromList(target); } if (!event->isAccepted()) HStatement::keyPressEvent(target, event); }
bool LRUCache::Touch(const char* key) { void* p; if (!v.Lookup(key, p)) return false; VarEntry* e = (VarEntry*) p; // already head? if (!e->prev) return true; removeFromList(e); // re-add e as head: e->prev = 0; e->next = head; head->prev = e; head = e; if (tail == 0) tail = head; return true; }
//Main loop void startMainLoop(node_s** _p_table, SDL_Surface* _p_screen, int _coef) { //Open list list_s* p_openList = NULL; node_s* p_currentNode = g_startNode; p_currentNode->cost = getDistance(p_currentNode, g_targetNode); while(p_currentNode != g_targetNode) { TRACE_DEBUG("current node x=%d, y=%d \n", p_currentNode->x, p_currentNode->y); //Treat adjacent node for(int i=p_currentNode->x-1; i<=p_currentNode->x+1; i++) { for(int j=p_currentNode->y-1; j<=p_currentNode->y+1; j++) { TRACE_DEBUG("i=%d, j=%d\n", i, j); if((i>=0) && (j>=0) && (i<(TABLE_LENGTH/GRID_SIZE)) && (j<(TABLE_WIDTH/GRID_SIZE)) && ((i != p_currentNode->x) || (j!=p_currentNode->y))) { computeNode(&p_openList, &_p_table[i][j], p_currentNode); #if DYNAMIC_PRINTING draw_unitary_surface(_p_table[i][j], 2, _p_screen); #endif } } } if(p_openList->p_node != NULL) { p_openList->p_node->nodeType = CLOSED_LIST; p_currentNode = p_openList->p_node; #if DYNAMIC_PRINTING draw_unitary_surface(*p_openList->p_node, 2, _p_screen); #endif removeFromList(p_openList, p_openList->p_node); } else { TRACE_INFO("No solution!\n"); break; } } getPath(p_currentNode, _p_table, _p_screen); }
/* ------------------------------------------------------------------------ Name - dispatcher Purpose - runs the highest priority runnable process Parameters - none Returns - nothing Side Effects - runs a process ----------------------------------------------------------------------- */ void dispatcher() { Check_Your_Privilege(); int_disable(); // USLOSS_Console("dispatcher Called, ready List: "); // printList(&readyHead); /*Adjust Runttime for current process*/ int timeRun; if (procTable[currPid].lastStartedTime==FIRST_RUN) { timeRun=0; }else{ timeRun=USLOSS_Clock()-procTable[currPid].lastStartedTime; } procTable[currPid].cpuTime+=timeRun; /* * Run the highest priority runnable process. There is guaranteed to be one * because the sentinel is always runnable. */ // USLOSS_Console("In dispatcher PID -- before: %d\n", currPid); int oldpid = currPid; PCB* readyListPos=&readyHead; // USLOSS_Console("dispatcher Check point 1\n"); readyListPos->nextPCB->state=0;//set state to running /*Set Proc state to ready unless it has quit or been killed*/ if(procTable[oldpid].state==0){ procTable[oldpid].state=1; } // USLOSS_Console("dispatcher Check point 2\n"); currPid = readyListPos->nextPCB->PID; procTable[currPid].lastStartedTime=USLOSS_Clock(); // USLOSS_Console("dispatcher Check point 3\n"); /*Adds currpid to end of its priority section in the Rdy list*/ removeFromList(currPid); addToReadyList(currPid); /*Reenable Interrupts*/ int_enable(); // USLOSS_Console("In dispatcher switching to PID: %d\n", currPid); USLOSS_ContextSwitch(&(procTable[oldpid]).context, &(readyListPos->nextPCB->context)); }
int P1_P(P1_Semaphore sem){ Check_Your_Privilege(); Semaphore* semP=(Semaphore*)sem; if(semP->valid>Clock_Sema&&semP->valid<MMU_Sema){ // USLOSS_Console("In P1_P for %d,Sem Table Pos: %d\n",currPid,semP->valid); procTable[currPid].waitingOnDevice=1; } // check if the process is killed if(procTable[currPid].state == 2){ return -2; } // check if the semaphore is valid if(semP==NULL||semP->valid<0){ USLOSS_Console("Semaphore is invalid\n"); return - 1; } // move process from ready queueu to semaphore->procQue // USLOSS_Console("In P1_P for %d\n",currPid); while(1){ int_disable(); if(semP->value > 0){ semP->value--; break; } if(currPid!=-1){ procTable[currPid].state = 4; // waiting status // USLOSS_Console("CurrPid %d has state=%d\n",currPid,procTable[currPid].state); removeFromList(currPid); addToProcQue(currPid,*semP); dispatcher(); } int_enable(); // USLOSS_Console("In P1_P for %d\n",currPid); } int_enable(); // USLOSS_Console("Exiting P1_P for %d\n",currPid); //interrupt enable return 0; }
static void processTimeouts(upile_context* context) { upil_printf(MSG_EXCESSIVE, "~~~~ +processTimeouts ~~~~"); MUTEX_ACQUIRE(context->listMutex); struct timeval now; struct upil_event * tev = context->timer_list.next; struct upil_event * next; getNow(&now); // walk list, see if now >= ev->timeout for any events upil_printf(MSG_EXCESSIVE, "~~~~ Looking for timers <= %ds + %dus ~~~~", (int)now.tv_sec, (int)now.tv_usec); while ((tev != &context->timer_list) && (timercmp(&now, &tev->timeout, >))) { // Timer expired upil_printf(MSG_EXCESSIVE, "~~~~ firing timer ~~~~"); next = tev->next; removeFromList(tev); addToList(tev, &context->pending_list); tev = next; }
void schedule(void *param) { struct epoll_event *events; #ifdef DEBUG fprintf(stderr, "entered scheduler"); #endif int i; char buff[7]; events = (struct epoll_event*) malloc( sizeof(struct epoll_event) * MAX_CLIENTS); while (1) { #ifdef DEBUG fprintf(stderr, "entered while loop"); #endif int numEvents = epoll_wait(epfd, events, MAX_CLIENTS, -1); if (numEvents == 0) { #ifdef DEBUG fprintf(stderr, "out of scheduler"); #endif break; } #ifdef DEBUG fprintf(stderr, "out of wait"); #endif for (i = 0; i < numEvents; i++) { int fd = events[i].data.fd; Receive(fd, buff, sizeof(int) + 1); linkedList *temp = searchScheduler(socketList, fd); if (atoi(buff) >= 0 && temp != NULL ) { temp->data.priority = ((float) (atoi(buff) + 1)) * 1000; } //if the listener is closing, it sends -1 as the panning speed else { close(fd); if (temp != NULL ) { socketList = removeFromList(socketList, temp->data); } } } } }
int main() { /* test de la liste */ pthread_t th_test1 = 14862153215624521; /*pthread_t th_test2; pthread_t th_test3; pthread_t th_test4;*/ Liste testList = creatList(); printf("liste vide creee\n"); if(isEmpty(testList)) printf("la liste est bien vide\n"); else { printf("erreur liste non vide !\n") ; exit(99); } testList = addInList(testList, th_test1); printf("ajout d'un element dans la liste\n"); mapList(testList); testList = removeFromList(testList, th_test1); if(isEmpty(testList)) printf("la liste est bien vide\n"); else { printf("erreur liste non vide !\n") ; exit(99); } destroyList(testList); /*Fin des test de la liste*/ return 0; }
/* if pMatchingFunction return true for an elem then this elem is remove and search stop */ t_bool METH(removeMatching)(hList listHandle, void *pMatchingFunction, void *pMatchingFunctionArgs) { t_list_imp *pList = (t_list_imp *) listHandle; listMatchingFuntion matchingFunction = (listMatchingFuntion) pMatchingFunction; t_list_link *pCurrent; t_bool res = 0; if (pList->mutex) {eeMutexLock(pList->mutex);} pCurrent = pList->pFIRST; while(pCurrent) { res = (*matchingFunction)(pCurrent, pMatchingFunctionArgs); if (res) {break;} pCurrent = pCurrent->pNext; } if (res) {removeFromList(pList, pCurrent);} if (pList->mutex) {eeMutexUnlock(pList->mutex);} return res; }
/* ------------------------------------------------------------------------ Name - P1_Quit Purpose - Causes the process to quit and wait for its parent to call P1_Join. Parameters - quit status Returns - nothing Side Effects - the currently running process quits ------------------------------------------------------------------------ */ void P1_Quit(int status) { Check_Your_Privilege(); // USLOSS_Console("In quit PID -- before: %d\n", currPid); int i; for (i = 0; i < P1_MAXPROC; i++) { if(procTable[i].parent==currPid){ procTable[i].isOrphan = 1; // orphanize the children } } // USLOSS_Console("Process: %s Quitting pid=%d\n",procTable[currPid].name,currPid); procTable[currPid].state = 3; procTable[currPid].status = status; numProcs--; // USLOSS_Console("Process state: %d\n", procTable[currPid].state); // USLOSS_Console("PID : %d\n", currPid); /*Remove from Ready List*/ removeFromList(currPid); /*Add to blocked List*/ addToQuitList(currPid); // USLOSS_Console("Orphan Status: %d",procTable[currPid].isOrphan); /*remove if orphan*/ if(procTable[currPid].isOrphan){//||procTable[currPid].parent==-1){ removeProc(currPid); }else{ P1_Semaphore semi = &semTable[procTable[currPid].parent]; // USLOSS_Console("Quit P1_V for %d",currPid); P1_V(semi); } //USLOSS_Console("In quit PID -- after: %d\n", currPid); // USLOSS_Console("Number of processes: %d\n", numProcs); dispatcher(); }