Пример #1
0
	/// Run all currently active schedulers.
	/// If we're the only reference holder to a document, release the document and its scheduler
	void update( void )
	{
		SchedulerMap::iterator it = schedulers.begin();
		while( it != schedulers.end() ) {
			// grab the next pointer in case we erase the current one
			SchedulerMap::iterator next = it;
			next++;

			ElementDocument *doc = it->first;
			FunctionCallScheduler *scheduler = it->second;

			if( doc->GetReferenceCount() == 1 ) {
				scheduler->shutdown();
				__delete__( scheduler );

				doc->RemoveReference();

				schedulers.erase( it );
			}
			else {
				scheduler->update();
			}

			// advance
			it = next;
		}
	}