예제 #1
0
//
// Handed to the APR thread creation function
//
void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap)
{
	LLThread *threadp = (LLThread *)datap;

	// Run the user supplied function
	threadp->run();

	llinfos << "LLThread::staticRun() Exiting: " << threadp->mName << llendl;
	
	// We're done with the run function, this thread is done executing now.
	threadp->mStatus = STOPPED;

	return NULL;
}
예제 #2
0
//
// Handed to the APR thread creation function
//
void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap)
{
	LLThread *threadp = (LLThread *)datap;

	// Set thread state to running
	threadp->mStatus = RUNNING;

	// Create a thread local APRFile pool.
	LLVolatileAPRPool::createLocalAPRFilePool();

	// Run the user supplied function
	threadp->run();

	llinfos << "LLThread::staticRun() Exiting: " << threadp->mName << llendl;
	
	// We're done with the run function, this thread is done executing now.
	threadp->mStatus = STOPPED;

	return NULL;
}
예제 #3
0
//
// Handed to the APR thread creation function
//
void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap)
{
#ifdef CWDEBUG
  	debug::init_thread();
#endif

	LLThread *threadp = (LLThread *)datap;

	// Initialize thread-local cache of current thread ID (if supported).
	AIThreadID::set_current_thread_id();

	// Create a thread local data.
	LLThreadLocalData::create(threadp);

	// Run the user supplied function
	threadp->run();

	// Setting mStatus to STOPPED is done non-thread-safe, so it's
	// possible that the thread is deleted by another thread at
	// the moment it happens... therefore make a copy here.
	char const* volatile name = threadp->mName.c_str();
	
	// Always make sure that sRunning <= number of threads with status RUNNING,
	// so do this before changing mStatus (meaning that once we see that we
	// are STOPPED, then sRunning is also up to date).
	--sRunning;

	// We're done with the run function, this thread is done executing now.
	threadp->mStatus = STOPPED;

	// Only now print this info [doing that before setting mStatus
	// to STOPPED makes it much more likely that another thread runs
	// after the LLCurl::Multi::run() function exits and we actually
	// change this variable (which really SHOULD have been inside
	// the critical area of the mSignal lock)].
	lldebugs << "LLThread::staticRun() Exiting: " << name << llendl;

	--sRunning;		// Would be better to do this after joining with the thread, but we don't join :/
	return NULL;
}
예제 #4
0
//
// Handed to the APR thread creation function
//
void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap)
{
#ifdef CWDEBUG
    debug::init_thread();
#endif

    LLThread *threadp = (LLThread *)datap;

#if !LL_DARWIN
    sThreadID = threadp->mID;
#endif


    // Create a thread local data.
    AIThreadLocalData::create(threadp);

    // Run the user supplied function
    threadp->run();

    // Setting mStatus to STOPPED is done non-thread-safe, so it's
    // possible that the thread is deleted by another thread at
    // the moment it happens... therefore make a copy here.
    char const* volatile name = threadp->mName.c_str();

    // We're done with the run function, this thread is done executing now.
    threadp->mStatus = STOPPED;

    // Only now print this info [doing that before setting mStatus
    // to STOPPED makes it much more likely that another thread runs
    // after the LLCurl::Multi::run() function exits and we actually
    // change this variable (which really SHOULD have been inside
    // the critical area of the mSignal lock)].
    llinfos << "LLThread::staticRun() Exiting: " << name << llendl;

    return NULL;
}