[reSIProcate] Threading and polling loops
Title: Message
Hi
all
I have been working
with the stack for a short time and I am trying to determine the most efficient
way to use the stack in a multithreaded environment. I understand I can
attach Transports that run as independent threads. The interface between
the stack and transports for passing events is the Fifo. This looks clean
except for one concern: both the Transport and the stack require polling
loops. The Transport does it explicitly in thread() with a 100 millisec
poll time. The stack is polled at whatever rate the application decides,
but using the same FdSet::selectMilliSeconds() call.
I would prefer to
use a completely event driven system. Is there any way in the existing codebase
to have a pair of transport threads? One that reads using select to get IO
ready events and a second that transmits and blocks on the FIFO? In a
similar train of thought, I would like to be able to run the stack in a thread
that blocks on the state machine FIFO (which would presumably get filled from
not only the read-mode transport thread, but also from other application
threads.
Any thoughts?
I am not suggesting redesign here, just wondering if I have missed some ways to
do what I am attempting.
Dennis Dupont
Senior Systems Architect
Intelemedia
Communications, Inc.