>> > So I called DetachThread before Attach Thread, but now I get the
>> > exception that the socket cannot be detached.
>>
>> You can detach a socket from a thread only when you call
>> ThreadDetach within the same thread context
>> which called TreadAttach (or the creating thread context if
>> no attach has been done). See how
>> ThreadDetach and ThreadAttach are implemented: they save and
>> check thread ID.
>
> Okay, but that is problematic for me. It may occur that the thread who
> created the socket is already gone

Sorry but this is bad design. Before going down, you thread has either to 
free the component, or the detach it and somehow make another thread (the 
main thread) attach it to be able to free it later.

>> btw: Have you read my previous messages ? I'm still convinced
>> you are confusing TThread class with
>> thread execution context.

> I do understand now that only the code within the execute method of a
> TThread descendant runs in the context of that thread.

That's not correct. Not only code executed within the execute method runs in 
the context of that thread, but also anything called directly or indirectly 
(such as an event handler) from the execute method.

> All other method of that TThread descendant won't unless
> being called from the own execute method.

That's correct.

--
[EMAIL PROTECTED]
http://www.overbyte.be

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

Reply via email to