diff options
Diffstat (limited to 'src/vm/win32threadpool.h')
-rw-r--r-- | src/vm/win32threadpool.h | 92 |
1 files changed, 17 insertions, 75 deletions
diff --git a/src/vm/win32threadpool.h b/src/vm/win32threadpool.h index 6b4f1dfe07..65be889a50 100644 --- a/src/vm/win32threadpool.h +++ b/src/vm/win32threadpool.h @@ -455,8 +455,7 @@ public: MEMTYPE_AsyncCallback = 0, MEMTYPE_DelegateInfo = 1, MEMTYPE_WorkRequest = 2, - MEMTYPE_PostRequest = 3, - MEMTYPE_COUNT = 4, + MEMTYPE_COUNT = 3, }; static BOOL Initialize(); @@ -554,17 +553,6 @@ public: static BOOL HaveTimerInfosToFlush() { return TimerInfosToBeRecycled != NULL; } - inline static BOOL IsThreadPoolHosted() - { -#ifdef FEATURE_INCLUDE_ALL_INTERFACES - IHostThreadpoolManager *provider = CorHost2::GetHostThreadpoolManager(); - if (provider) - return TRUE; - else -#endif - return FALSE; - } - #ifndef FEATURE_PAL static LPOVERLAPPED CompletionPortDispatchWorkWithinAppDomain(Thread* pThread, DWORD* pErrorCode, DWORD* pNumBytes, size_t* pKey, DWORD adid); static void StoreOverlappedInfoInThread(Thread* pThread, DWORD dwErrorCode, DWORD dwNumBytes, size_t key, LPOVERLAPPED lpOverlapped); @@ -617,44 +605,6 @@ private: wr->next = NULL; return wr; } - - struct PostRequest { - LPOVERLAPPED_COMPLETION_ROUTINE Function; - DWORD errorCode; - DWORD numBytesTransferred; - LPOVERLAPPED lpOverlapped; - }; - - - inline static PostRequest* MakePostRequest(LPOVERLAPPED_COMPLETION_ROUTINE function, LPOVERLAPPED overlapped) - { - CONTRACTL - { - THROWS; - GC_NOTRIGGER; - MODE_ANY; - } - CONTRACTL_END;; - - PostRequest* pr = (PostRequest*) GetRecycledMemory(MEMTYPE_PostRequest); - _ASSERTE(pr); - if (NULL == pr) - return NULL; - pr->Function = function; - pr->errorCode = 0; - pr->numBytesTransferred = 0; - pr->lpOverlapped = overlapped; - - return pr; - } - - inline static void ReleasePostRequest(PostRequest *postRequest) - { - WRAPPER_NO_CONTRACT; - ThreadpoolMgr::RecycleMemory(postRequest, MEMTYPE_PostRequest); - } - - typedef Wrapper< PostRequest *, DoNothing<PostRequest *>, ThreadpoolMgr::ReleasePostRequest > PostRequestHolder; #endif // #ifndef DACCESS_COMPILE @@ -1047,7 +997,7 @@ public: // Private methods - static DWORD __stdcall intermediateThreadProc(PVOID arg); + static DWORD WINAPI intermediateThreadProc(PVOID arg); typedef struct { LPTHREAD_START_ROUTINE lpThreadFunction; @@ -1128,20 +1078,14 @@ public: static void NotifyWorkItemCompleted() { WRAPPER_NO_CONTRACT; - if (!CLRThreadpoolHosted()) - { - Thread::IncrementThreadPoolCompletionCount(); - UpdateLastDequeueTime(); - } + Thread::IncrementThreadPoolCompletionCount(); + UpdateLastDequeueTime(); } static bool ShouldAdjustMaxWorkersActive() { WRAPPER_NO_CONTRACT; - if (CLRThreadpoolHosted()) - return false; - DWORD priorTime = PriorCompletedWorkRequestsTime; MemoryBarrier(); // read fresh value for NextCompletedWorkRequestsTime below DWORD requiredInterval = NextCompletedWorkRequestsTime - priorTime; @@ -1163,7 +1107,7 @@ public: static DWORD SafeWait(CLREvent * ev, DWORD sleepTime, BOOL alertable); - static DWORD __stdcall WorkerThreadStart(LPVOID lpArgs); + static DWORD WINAPI WorkerThreadStart(LPVOID lpArgs); static BOOL AddWaitRequest(HANDLE waitHandle, WaitInfo* waitInfo); @@ -1172,7 +1116,7 @@ public: static BOOL CreateWaitThread(); - static void __stdcall InsertNewWaitForSelf(WaitInfo* pArg); + static void WINAPI InsertNewWaitForSelf(WaitInfo* pArg); static int FindWaitIndex(const ThreadCB* threadCB, const HANDLE waitHandle); @@ -1182,14 +1126,12 @@ public: unsigned index, // array index BOOL waitTimedOut); - static DWORD __stdcall WaitThreadStart(LPVOID lpArgs); + static DWORD WINAPI WaitThreadStart(LPVOID lpArgs); - static DWORD __stdcall AsyncCallbackCompletion(PVOID pArgs); + static DWORD WINAPI AsyncCallbackCompletion(PVOID pArgs); static void QueueTimerInfoForRelease(TimerInfo *pTimerInfo); - static DWORD __stdcall QUWIPostCompletion(PVOID pArgs); - static void DeactivateWait(WaitInfo* waitInfo); static void DeactivateNthWait(WaitInfo* waitInfo, DWORD index); @@ -1210,7 +1152,7 @@ public: count * sizeof(LIST_ENTRY)); } - static void __stdcall DeregisterWait(WaitInfo* pArgs); + static void WINAPI DeregisterWait(WaitInfo* pArgs); #ifndef FEATURE_PAL // holds the aggregate of system cpu usage of all processors @@ -1227,7 +1169,7 @@ public: static int GetCPUBusyTime_NT(PROCESS_CPU_INFORMATION* pOldInfo); static BOOL CreateCompletionPortThread(LPVOID lpArgs); - static DWORD __stdcall CompletionPortThreadStart(LPVOID lpArgs); + static DWORD WINAPI CompletionPortThreadStart(LPVOID lpArgs); public: inline static bool HaveNativeWork() { @@ -1248,7 +1190,7 @@ private: static BOOL CreateGateThread(); static void EnsureGateThreadRunning(); static bool ShouldGateThreadKeepRunning(); - static DWORD __stdcall GateThreadStart(LPVOID lpArgs); + static DWORD WINAPI GateThreadStart(LPVOID lpArgs); static BOOL SufficientDelaySinceLastSample(unsigned int LastThreadCreationTime, unsigned NumThreads, // total number of threads of that type (worker or CP) double throttleRate=0.0 // the delay is increased by this percentage for each extra thread @@ -1257,17 +1199,17 @@ private: static LPVOID GetRecycledMemory(enum MemType memType); - static DWORD __stdcall TimerThreadStart(LPVOID args); + static DWORD WINAPI TimerThreadStart(LPVOID args); static void TimerThreadFire(); // helper method used by TimerThreadStart - static void __stdcall InsertNewTimer(TimerInfo* pArg); + static void WINAPI InsertNewTimer(TimerInfo* pArg); static DWORD FireTimers(); - static DWORD __stdcall AsyncTimerCallbackCompletion(PVOID pArgs); + static DWORD WINAPI AsyncTimerCallbackCompletion(PVOID pArgs); static void DeactivateTimer(TimerInfo* timerInfo); - static DWORD __stdcall AsyncDeleteTimer(PVOID pArgs); + static DWORD WINAPI AsyncDeleteTimer(PVOID pArgs); static void DeleteTimer(TimerInfo* timerInfo); - static void __stdcall UpdateTimer(TimerUpdateInfo* pArgs); + static void WINAPI UpdateTimer(TimerUpdateInfo* pArgs); - static void __stdcall DeregisterTimer(TimerInfo* pArgs); + static void WINAPI DeregisterTimer(TimerInfo* pArgs); inline static DWORD QueueDeregisterWait(HANDLE waitThread, WaitInfo* waitInfo) { |