[twsocket] FPC and ICS, forms, messaging.

Francois PIETTE francois.piette@pophost.eunet.be
Sun, 11 Jun 2000 19:52:42 +0200

> I don't exactly get what the message stuff does.  (I'm just starting
> programming, I do *nix and Go32v2 usually)

Windows has a message queue for each thread. The message queue is used by
the OS and applications to queue messages to signal events. Speaking
winsock, when data is available, winsock place a message in the message
queue for the thread owning the socket. Same with connect, write and other
events. TWSocket process those messages and transform most of them to

TWSocket also use messages to request for some operation to be done after
the current event has been processed.

It is not easy to port a message based component to an environment without
message processing. You cana chieve more or less the same behaviour using
threads (blocked waiting for something to happend such as datavailable) and
flags (to do some processing later). Probelm with multithreading is to find
a way to make a routine executable in one thread context when it has been
triggered by a worker thread (a task similar to Delphi Synchronize method
which is implemented using a message).