Esempio n. 1
0
// figure out what the user wants to do!
int body()
{
    char c;
    while(1)
    {
        color = 0x01 + (running->pid % NPROC); // change the text color based on the process id!
        printf("\n******************************\n");
        printf("Currently Running Process #%d", running->pid);
        printf("\nReady Queue: ");
        printQueue(readyQueue);
        printf("******************************\n");
        printf("Input a command [s | q | f | r | ?]:");
        c = getc();
        printf("\n");
        switch (c)
        {
            case 's': tswitch(); break;
            case 'q': zombify(); break;
            case 'f': kfork(); break;
            case 'r': resurrect(); break;
            case '?': help(); break;
            default: break;
        }
    }
}
Esempio n. 2
0
void lush_delete(at *p)
{
   if (!p || ZOMBIEP(p))
      return;

   class_t *cl = classof(p);
   if (cl->dontdelete)
      error(NIL, "cannot delete this object", p);
   
   run_notifiers(p);
   
   if (cl->has_compiled_part) {
      assert(isa(p, object_class));
      /* OO objects may have two parts          */
      /* lush_delete has to delete both of them */
      object_t *obj = Mptr(p);
      struct CClass_object *cobj = obj->cptr;
      oostruct_dispose(obj);
      cobj->Vtbl->Cdestroy(cobj);
      
   } else {
      if (Class(p)->dispose)
         Mptr(p) = Class(p)->dispose(Mptr(p));
      else
         Mptr(p) = NULL;
   }
   zombify(p);
}
void GFXGLCubemap::_onTextureEvent( GFXTexCallbackCode code )
{
   if ( code == GFXZombify )
      zombify();
   else
      tmResurrect();
}
Esempio n. 4
0
void HSolve::setup( Eref hsolve )
{
    // Setup solver.
    this->HSolveActive::setup( seed_, dt_ );

    mapIds();
    zombify( hsolve );
}
Esempio n. 5
0
SysArena* ThreadCachedArena::allocateThreadLocalArena() {
  SysArena* arena = new SysArena(minBlockSize_);
  auto disposer = [this] (SysArena* t, TLPDestructionMode mode) {
    std::unique_ptr<SysArena> tp(t);  // ensure it gets deleted
    if (mode == TLPDestructionMode::THIS_THREAD) {
      zombify(std::move(*t));
    }
  };
  arena_.reset(arena, disposer);
  return arena;
}
Esempio n. 6
0
void HSolveHub::manageCaConcs()
{
	const vector< Id >& idlist = integ_->getCaConcs();
	vector< Element* > elist;
	idlist2elist( idlist, elist );
	
	vector< Element* >::const_iterator i;
	for ( i = elist.begin(); i != elist.end(); i++ ) {
		zombify( hub_, *i, caconcSolveFinfo, caconcZombieFinfo );
		
		redirectDynamicMessages( *i );
	}
}
Esempio n. 7
0
GFXD3D11TextureTarget::~GFXD3D11TextureTarget()
{
   // Release anything we might be holding.
   for(S32 i=0; i<MaxRenderSlotId; i++)
   {
      mResolveTargets[i] = NULL;
      SAFE_RELEASE(mTargetViews[i]);
      SAFE_RELEASE(mTargets[i]);
      SAFE_RELEASE(mTargetSRViews[i]);      
   }

   zombify();
}
Esempio n. 8
0
GFXPCD3D9TextureTarget::~GFXPCD3D9TextureTarget()
{
   // Release anything we might be holding.
   for(S32 i=0; i<MaxRenderSlotId; i++)
   {
      mResolveTargets[i] = NULL;

      if( GFXDevice::devicePresent() )
      {
         mDevice->destroyD3DResource( mTargets[i] ); // SAFE_RELEASE
         mTargets[i] = NULL;
      }
      else
         SAFE_RELEASE( mTargets[i] );
   }

   zombify();
}
Esempio n. 9
0
static object_t *oostruct_dispose(object_t *obj)
{
   /* oostruct gets called only once */
   assert(!ZOMBIEP(obj->backptr));

   obj->next_unreachable = NULL;

   int oldready = error_doc.ready_to_an_error;
   error_doc.ready_to_an_error = true;
   struct lush_context mycontext;
   context_push(&mycontext);
   
   int errflag = sigsetjmp(context->error_jump,1);
   if (errflag==0) {
      /* call all destructors for interpreted part */
      /* destructors for compiled part are called  */
      /* by finalizer for compiled part            */
      at *f = NIL;
      class_t *cl = Class(obj->backptr);
      while (cl) {
         struct hashelem *hx = _getmethod(cl, at_destroy);
         cl = cl->super;
         if (! hx)
            break;
         else if (hx->function == f)
            continue;
         else if (classof(hx->function) == dh_class)
            break;
         call_method(obj->backptr, hx, NIL);
         f = hx->function;
      }
   }
   
   context_pop();
   error_doc.ready_to_an_error = oldready;
   if (obj->cptr)
      obj->cptr->__lptr = NULL;
   zombify(obj->backptr);
   
   if (errflag)
      siglongjmp(context->error_jump, -1L);

   return obj;
}
Esempio n. 10
0
void HSolveHub::manageCompartments()
{
	const vector< Id >& idlist = integ_->getCompartments();
	vector< Element* > elist;
	idlist2elist( idlist, elist );
	
	const vector< vector< Id > >& externalChannelIds =
		integ_->getExternalChannels();
	vector< Element* > extChanList;
	
	const Finfo* initFinfo = initCompartmentCinfo()->findFinfo( "init" );
	vector< Element* >::const_iterator i;
	for ( i = elist.begin(); i != elist.end(); i++ ) {
		zombify( hub_, *i, compartmentSolveFinfo, compartmentZombieFinfo );
		
		// Compartment receives 2 shared messages from Tick's "process"
		Eref( *i ).dropAll( initFinfo->msg() );
		
		redirectDynamicMessages( *i );
	}
	
	/*
	 * Redirecting dest/shared messages
	 */
	for ( unsigned int ic = 0; ic < elist.size(); ic++ ) {
		// The 'retain' flag at the end is 1: we do not delete the original
		// message to the compartment.
		redirectDestMessages(
			hub_, elist[ ic ],
			hubCompartmentInjectFinfo, compartmentInjectFinfo, 
			ic, compartmentInjectMap_,
			&elist, 0,
			1 );
		
		extChanList.clear();
		idlist2elist( externalChannelIds[ ic ], extChanList );
		redirectDestMessages(
			hub_, elist[ ic ],
			hubCompartmentChannelFinfo, compartmentChannelFinfo, 
			ic, compartmentChannelMap_,
			&elist, &extChanList,
			1 );
	}
}
Esempio n. 11
0
static class_t *class_dispose(class_t *cl)
{
   /* remove atclass in dhclassdoc */
   if (cl->classdoc)
      cl->classdoc->lispdata.atclass = 0;
   
   /* unlink from subclass chain */
   if (cl->super) {
      class_t **p = &(cl->super->subclasses);
      while (*p && (*p != cl))
         p = &((*p)->nextclass);
      if (*p == cl)
         *p = cl->nextclass;
      cl->super = NULL;
   }
   /* mark class and all subclasses as obsolete */
   zombify_subclasses(cl);
   cl->live = false;
   zombify(cl->backptr);
   return cl;
}