/*
 * This function is where new threads start running. The arguments
 * ENTRYPOINT, DATA1, and DATA2 are passed through from thread_fork.
 *
 * Because new code comes here from inside the middle of
 * thread_switch, the beginning part of this function must match the
 * tail of thread_switch.
 */
void
thread_startup(void (*entrypoint)(void *data1, unsigned long data2),
               void *data1, unsigned long data2)
{
    struct thread *cur;

    cur = curthread;

    /* Clear the wait channel and set the thread state. */
    cur->t_wchan_name = NULL;
    cur->t_state = S_RUN;

    /* Release the runqueue lock acquired in thread_switch. */
    spinlock_release(&curcpu->c_runqueue_lock);

    /* Activate our address space in the MMU. */
    as_activate();

    /* Clean up dead threads. */
    exorcise();

    /* Enable interrupts. */
    spl0();

    /* Call the function. */
    entrypoint(data1, data2);

    /* Done. */
    thread_exit();
}
Пример #2
0
/*
 * This function is where new threads start running. The arguments
 * ENTRYPOINT, DATA1, and DATA2 are passed through from thread_fork.
 *
 * Because new code comes here from inside the middle of
 * thread_switch, the beginning part of this function must match the
 * tail of thread_switch.
 */
void
thread_startup(void (*entrypoint)(void *data1, unsigned long data2),
	       void *data1, unsigned long data2)
{
	struct thread *cur;

	cur = curthread;

	/* Clear the wait channel and set the thread state. */
	cur->t_wchan_name = NULL;
	cur->t_state = S_RUN;

	/* Release the runqueue lock acquired in thread_switch. */
	spinlock_release(&curcpu->c_runqueue_lock);

	/* Activate our address space in the MMU. */
	as_activate();

	/* Clean up dead threads. */
	exorcise();

	/* Enable interrupts. */
	spl0();

#if OPT_SYNCHPROBS
	/* Yield a random number of times to get a good mix of threads. */
	{
		int i, n;
		n = random()%161 + random()%161;
		for (i=0; i<n; i++) {
			thread_yield();
		}
	}
#endif

	/* Call the function. */
	entrypoint(data1, data2);

	/* Done. */
	thread_exit();
}
Пример #3
0
void
CSDReader::code (DOMElement* element)
throw(CSDReadException)
{
	std::string type = Qedo::transcode(element->getAttribute(X("type")));
	std::string file_name;
	std::string element_name;
	std::string entry;
	std::string use;

	DOMNode* child = element->getFirstChild();
	while (child != 0)
	{
		if (child->getNodeType() == DOMNode::ELEMENT_NODE)
		{
			element_name = Qedo::transcode(child->getNodeName());

			//
			// codebase
			//
			if (element_name == "codebase")
			{
				// TODO
			}

			//
			// fileinarchive
			//
			else if (element_name == "fileinarchive")
			{
				file_name = fileinarchive((DOMElement*)child).file;
			}

			//
			// link
			//
			else if (element_name == "link")
			{
				file_name = link((DOMElement*)child).file;
			}

			//
			// entrypoint
			//
			else if (element_name == "entrypoint")
			{
				entry = entrypoint((DOMElement*)child);
			}

			//
			// usage
			//
			else if (element_name == "usage")
			{
				use = usage((DOMElement*)child);
			}
		}

        // get next child
	    child = child->getNextSibling();
	}

	//
	// dynamic library
	//
	if (type == "DLL")
	{
		if (use == "servant")
		{
			data_->servant_module = file_name;
			data_->servant_entry_point = entry;
			DEBUG_OUT2( "CSDReader: <code> for servants ", file_name);
		}
		else 
		{
			data_->executor_module = file_name;
			data_->executor_entry_point = entry;
			DEBUG_OUT2( "CSDReader: <code> for business ", file_name);
		}
    }

	//
	// artifact
	//
	else if (type == "Executable")
	{
		data_->artifacts.push_back( file_name );
		DEBUG_OUT2( "CSDReader: <code> for artifact ", file_name);
    }
}