Пример #1
0
    void BackgroundJobProcessor::DissociatePageAllocator(PageAllocator* const pageAllocator)
    {
        // This function is called from the foreground thread
#if DBG
        // Assert that the dissociation is happening in the same thread that created the background job processor
        Assert(GetCurrentThreadContextId() == this->threadId);
        pageAllocator->ClearConcurrentThreadId();
#endif
    }
Пример #2
0
 StringProfiler::StringProfiler(PageAllocator * pageAllocator)
   : allocator(L"StringProfiler", pageAllocator, Throw::OutOfMemory ),
     mainThreadId(GetCurrentThreadContextId() ),
     discardedWrongThread(0),
     stringLengthMetrics(&allocator),
     embeddedNULChars(0),
     embeddedNULStrings(0),
     emptyStrings(0),
     singleCharStrings(0),
     stringConcatMetrics(&allocator, 43)
 {
 }
Пример #3
0
 BackgroundJobProcessor::BackgroundJobProcessor(AllocationPolicyManager* policyManager, JsUtil::ThreadService *threadService, bool disableParallelThreads)
     : JobProcessor(true),
     jobReady(true),
     wakeAllBackgroundThreads(false),
     numJobs(0),
     threadId(GetCurrentThreadContextId()),
     threadService(threadService),
     threadCount(0),
     maxThreadCount(0)
 {
     if (!threadService->HasCallback())
     {
         // We don't have a thread service, so create a dedicated thread to handle background jobs.
         InitializeParallelThreadData(policyManager, disableParallelThreads);
     }
     else
     {
         InitializeParallelThreadDataForThreadServiceCallBack(policyManager);
     }
 }
Пример #4
0
 bool StringProfiler::IsOnWrongThread() const
 {
     return GetCurrentThreadContextId() != this->mainThreadId;
 }