Re: [twsocket] Attach to a target thread?

2013-10-10 Thread François Piette
 So my question: is there any way to attach a client connection to 
 another thread immediately, from the main thread?

 Probably, but I've said I've not done it myself, no need.  
 Others may have done so,

 
This is not always possible, at least without modifying TIcsWndControl. The
problem is windows API cannot (AFAIK) be used to attach an existing windows
(Message queue in fact) to an existing thread. One must recreate the window
in the context of the thread. 

 but I don't believe it necessary for your application.

I share this opinion.
I would let the client sockets attached to a single the thread (no
necessarily the main thread) and handle all communication. Once a job has
been received, then the data is passed to a worker thread, thru a queue, for
processing. Probably a single queue serviced by a pool of thread is enough.


-- 
francois.pie...@overbyte.be
Embarcadero MVP
http://www.overbyte.be
http://francois-piette.blogspot.com




-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] RES: Attach to a target thread?

2013-10-10 Thread Éric Fleming Bonilha
François

 I share this opinion.
 I would let the client sockets attached to a single the thread (no
necessarily the main thread) and handle all communication. Once a job has
been received, then the data is passed to a worker thread, thru a queue, for
processing. Probably a single queue serviced by a pool of thread is enough.
 
What are your thoughts in having all communication in a single thread? In my
application we are starting to face some bottlenecks because all processing
of incomming data is received by the main thread, what we did was to change
the handle of some connections by detaching from main thread and attaching
to another thread to process the messages. The connections that we did that
are the ones that were causing the bottleneck.

So, my question is, in order to ICS to scale better in a multi-core machine
we should process the incoming Windows messages in different threads (Of
course, in a VERY WELL designed architecture to avoid deadlocks and
conflics) right?

Eric

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be