kernel/source/ipc/memticket.cpp
// called when the process is killed; basically we need to release all the
// collections of all the tickets the process is holding.
called when the process is killed; basically we need to release all the
collections of all the tickets the process is holding.
called when the process is killed ; basically we need to release all the collections of all the tickets the process is holding .
void cleanupProcessTickets(scheduler::Process* proc)
	{
		assert(proc);
		proc->collectedTickets.getLock().lock();
		auto& tiks = *proc->collectedTickets.get();
		for(memticket_id id : tiks)
		{
			bool cleanup = tickets.map([&](auto& tkts) -> bool {
				auto it = tkts.find(id);
				if(it == tkts.end())
				{
					warn("memticket", "process {} was holding onto invalid memticket {}", proc->processId, id);
					return false;
				}
				auto tik = &it->value;
				return LockedSection(&tik->physicalPages.mtx, [&]() -> bool {
					tik->deref();
					return tik->refcount == 0;
				});
			});
			if(cleanup)
				tickets.lock()->remove(id);
		}
		proc->collectedTickets.getLock().unlock();
	}
void cleanupProcessTickets ( scheduler :: Process * proc ) { assert ( proc ) ; proc -> collectedTickets . getLock ( ) . lock ( ) ; auto & tiks = * proc -> collectedTickets . get ( ) ; for ( memticket_id id : tiks ) { bool cleanup = tickets . map ( [ & ] ( auto & tkts ) -> bool { auto it = tkts . find ( id ) ; if ( it == tkts . end ( ) ) { warn ( " " , " " , proc -> processId , id ) ; return false ; } auto tik = & it -> value ; return LockedSection ( & tik -> physicalPages . mtx , [ & ] ( ) -> bool { tik -> deref ( ) ; return tik -> refcount == 0 ; } ) ; } ) ; if ( cleanup ) tickets . lock ( ) -> remove ( id ) ; } proc -> collectedTickets . getLock ( ) . unlock ( ) ; }
called when the process is killed; basically we need to release all the
collections of all the tickets the process is holding.
called when the process is killed ; basically we need to release all the collections of all the tickets the process is holding .