Thanks every one. I get the message about custom messages. Excuse the pun.
But one thing puzzles me still. How would I implement a timeout? Do I create a timer component within the thread, or is there a more elegant solution? For example, if there is nothing in the database for me to process, currently my thread holds off running the next query for a minute to save constantly hammering the database. Similarly, if I send something and do not get an expected response, I resend after a time delay. Regards, Andy Francois Piette wrote: >> Then my understanding from what you have said is that I only get to the >> // check if I need to do something >> >> when a quit is posted. >> >> I am running a finite state machine in the execute loop, which marshalls >> responses, checks timeouts etc. If I don't exit the message loop, I can't > do this. > > I understand what you mean. I'll try to help you: Writing your state machine > within an event driven worker thread is not different than writing it in the > main thread of a GUI application while maintening the UI responsive. A GUI > application has a message pump just as "MessageLoop" or TWSocket (It is > located in the Forms unit). > > You have to design you state machine having events in mind. Use a custom > message to switch form one state to the other. This will makes your state > machine work nicely within an event driven world. The infinite loop of most > finite state machine will simply be the message loop. > > Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html > -- > [EMAIL PROTECTED] > Author of ICS (Internet Component Suite, freeware) > Author of MidWare (Multi-tier framework, freeware) > http://www.overbyte.be > -- 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