Skip to content

Commit

Permalink
Allow workitems to startup faster and reduce polling thread interval …
Browse files Browse the repository at this point in the history
…in the threadpool.

Deals with xambug #14644 and similar issues.
  • Loading branch information
illupus committed Sep 24, 2013
1 parent 6cf0c51 commit 3c347d5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mono/metadata/threadpool.c
Expand Up @@ -771,7 +771,7 @@ monitor_thread (gpointer unused)
thread = mono_thread_internal_current ();
ves_icall_System_Threading_Thread_SetName_internal (thread, mono_string_new (mono_domain_get (), "Threadpool monitor"));
while (1) {
ms = 500;
ms = 2000;
i = 10; //number of spurious awakes we tolerate before doing a round of rebalancing.
do {
guint32 ts;
Expand Down Expand Up @@ -1041,6 +1041,7 @@ pulse_on_new_job (ThreadPool *tp)
{
if (tp->waiting)
MONO_SEM_POST (&tp->new_job);
threadpool_start_thread (tp);
}

void
Expand Down Expand Up @@ -1096,7 +1097,7 @@ threadpool_append_jobs (ThreadPool *tp, MonoObject **jobs, gint njobs)
mono_cq_enqueue (tp->queue, ar);
}

for (i = 0; tp->waiting > 0 && i < MIN(njobs, tp->max_threads); i++)
for (i = 0; i < MIN(njobs, tp->max_threads); i++)
pulse_on_new_job (tp);
}

Expand Down

0 comments on commit 3c347d5

Please sign in to comment.