On Wednesday, September 18, 2013 2:52 PM [GMT+1=CET],
Éric Fleming Bonilha wrote:

>>> My code  inside the event triggers is fine for multi-thread
> 
>> That is required indeed. For instance no access to the client list,
>> no plain access to the VCL etc.. 
> 
>> Without having a look at your source code it's hard to say.
> 
> Thanks, I just wanted to make sure that ICS itself would not have
> issues by the messages being processed from a different thread,
> especially when client disconnects, because you may have to process
> client list internally right? 

Just one problem that springs to mind is that when a client is closed
it posts a message to the listening socket's window and in listening
socket's thread context the client object will be freed and removed 
from the client list when this message is processed. TWsocket's destructor
may try to deallocate TWSocketClient's hidden window which must be 
either null (thread detached) or allocated in the calling thread context, 
otherwise this crashed.
One question that you should answer yourself as well would be how to 
make sure not to access an already freed TWSocketClient instance from
your thread context? Or how to ensure that a TWSocketClient instance 
will only ever been accessed by one thread at the same time? 
Also note that TWSocketServer methods are not thread-save.  

> I´m not accessing client list from
> inside events and everything that I do from event handlers are
> "thread-safe" 

That's fine, but likely not enough to be on the true thread-safe 
side, the longer I think about it the more complicated it becomes ;-)
Not trivial however possible!

-- 
Arno
-- 
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

Reply via email to