Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [dsdp-tcf-dev] Send an event from a worker thread

Hi Michael,

The TCF agent is single threaded, however sending does not cause the
thread to wait while the data is being transmitted unless there is
backpressure on stream and the socket buffer is full.  The socket buffer
can be set to a fairly large value, so even with a single thread it can
communicate with multiple connections.

It is also possible to run multiple instances of the agent, for example
in separate processes.  Each instance would have its own port number,
but all would be discoverable by clients and the Name property in the
discovery could be used to distinguish between the different instances.

It would also be possible to change the output stream so it builds
buffers that are transmitted by worker threads.  This is how the Java
implementation of TCF works.  However, the full extent of this work is
not clear to me, so I cannot judge how much work it would be or if it
would actually improve throughput. 

HTH,
Felix

> -----Original Message-----
> From: dsdp-tcf-dev-bounces@xxxxxxxxxxx [mailto:dsdp-tcf-dev-
> bounces@xxxxxxxxxxx] On Behalf Of Michael Sills-Lavoie
> Sent: Monday, June 15, 2009 5:50 AM
> To: DSDP TCF dev list
> Subject: Re: [dsdp-tcf-dev] Send an event from a worker thread
> 
> Hi,
> 
> Is there an other way to send event on a channel beside to use
> post_event()? I'm asking that because by doing this, only the "main"
> thread can send data. Is there a way to use multiple connexion to the
> agent and send data simultaneously to these connexion from multiple
> thread? It would be beneficial if a given server had many network
> cards.
> 
> Thanks
> 
> Michael
> 
> Tarassov, Eugene wrote:
> > Hi Michael,
> >
> > Yes, using post_event() is the right way to send a tcf event from a
> > background thread.
> > Also, if a background thread will hold a pointer to a channel
struct,
> > you should use stream_lock()/stream_unlock() to prevent the struct
> from
> > being freed.
> >
> > Regards,
> > Eugene
> >
> > -----Original Message-----
> > From: dsdp-tcf-dev-bounces@xxxxxxxxxxx
> > [mailto:dsdp-tcf-dev-bounces@xxxxxxxxxxx] On Behalf Of Michael
> > Sills-Lavoie
> > Sent: Friday, June 05, 2009 6:44 AM
> > To: DSDP TCF dev list
> > Subject: [dsdp-tcf-dev] Send an event from a worker thread
> >
> > Hi!
> >
> > I would like to know what is the right way to send a tcf event from
a
> > worker thread in the C agent?
> >
> > What I'm considering right now is to post an event from the worker
> > thread(a thread that is not the dispatch one) with the
> TCFBroadcastGroup
> > or a specefic channel as parameter.
> >
> > Then, in the callback function, I would send the data that the
thread
> > wanted to send on the channel (the data would be send in a protected
> > queue or something like that).
> >
> > Is this the best way to send data in an event from a thread?
> >
> > Thank you.
> >
> > Michael
> > _______________________________________________
> > dsdp-tcf-dev mailing list
> > dsdp-tcf-dev@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/dsdp-tcf-dev
> > _______________________________________________
> > dsdp-tcf-dev mailing list
> > dsdp-tcf-dev@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/dsdp-tcf-dev
> >
> 
> _______________________________________________
> dsdp-tcf-dev mailing list
> dsdp-tcf-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/dsdp-tcf-dev


Back to the top