Skip to content

Commit

Permalink
Only reschedule the GC collection timer from the main thread. Fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
s-ludwig committed Apr 21, 2016
1 parent 36c877a commit 9b77561
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions source/vibe/core/core.d
Original file line number Diff line number Diff line change
Expand Up @@ -1317,9 +1317,11 @@ private class VibeDriverCore : DriverCore {
}
if (!s_yieldedTasks.empty) logDebug("Exiting from idle processing although there are still yielded tasks");

if( !m_ignoreIdleForGC && m_gcTimer ){
m_gcTimer.rearm(m_gcCollectTimeout);
} else m_ignoreIdleForGC = false;
if (Thread.getThis() is st_mainThread) {
if (!m_ignoreIdleForGC && m_gcTimer) {
m_gcTimer.rearm(m_gcCollectTimeout);
} else m_ignoreIdleForGC = false;
}
}

bool isScheduledForResume(Task t)
Expand Down Expand Up @@ -1441,6 +1443,7 @@ private {

__gshared core.sync.mutex.Mutex st_threadsMutex;
__gshared ManualEvent st_threadsSignal;
__gshared Thread st_mainThread;
__gshared ThreadContext[] st_threads;
__gshared TaskFuncInfo[] st_workerTasks;
__gshared Condition st_threadShutdownCondition;
Expand Down Expand Up @@ -1507,6 +1510,8 @@ private void setupSignalHandlers()
// per process setup
shared static this()
{
st_mainThread = Thread.getThis();

version(Windows){
version(VibeLibeventDriver) enum need_wsa = true;
else version(VibeWin32Driver) enum need_wsa = true;
Expand Down

0 comments on commit 9b77561

Please sign in to comment.