public void _work()
{
// set locals for this actor
m_locals = m_context.m_locals;
Locale.setCur(m_context.m_locale);
// process up to 100 messages before yielding the thread
for (int count = 0; count < 100; count++)
{
// get next message, or if none pending we are done
Future future = null;
lock (m_lock) { future = m_queue.get(); }
if (future == null) break;
// dispatch the messge
_dispatch(future);
}
// flush locals back to context
m_context.m_locale = Locale.cur();
// done dispatching, either clear the submitted
// flag or resubmit to the thread pool
lock (m_lock)
{
if (m_queue.size == 0)
{
m_submitted = false;
}
else
{
m_submitted = true;
m_pool.submit(this);
}
}
}