True, I forgot about that, cheers. I will now look through the code and check this.

Is there a maximum amount of PostMessages(.) before problems arise? My PostMessages(..) aren't critical time needed, it is mostly checking the PER HANDLE info of each connection, or passing information to other connections when a certain condition happens. Within some of the PostMessage() routines, I simply go through the list of connections, and do an IOCP Send to each connection.

One thought (not often I get them). As PostMessage() passes info to the Messaging Queue of Windows, how does Windows handle , say 50 Messages waiting to be processed? Does one routine get done at a time, or many get called in different threads?

Thanks again
Neil

----- Original Message ----- From: "Jason Teagle" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Saturday, April 30, 2005 5:44 PM
Subject: RE: [msvc] Posting a message



Thanks Jason,
  I understand the need of  EnterCriticalSection() if both
threads sharing
memory, but if for example one thread is calling a function that is only
reading the memory, and the other thread updates it, is
EnterCriticalSection() still needed as only one is updating it?

It definitely IS needed in that case... imagine if one thread was halfway through writing the memory and hadn't finished updating memory - and then another thread cut in and tried reading... it could get messy. The reading thread might end up reading mismatched data, because only half of it had finished being written at the time. Make sense?

Memory blocks need protecting just the same as variables - for the exact
same reasons - after all, a variable is just a small memory block.

--
Jason Teagle
[EMAIL PROTECTED]



_______________________________________________
msvc mailing list
[email protected]
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for subscription changes, and list archive.





_______________________________________________
msvc mailing list
[email protected]
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for 
subscription changes, and list archive.

Reply via email to