Hello, On Wed, Dec 9, 2009 at 4:08 PM, Arno Garrels <arno.garr...@gmx.de> wrote:
> Anton Sviridov wrote: > > Hello! > > I'm writing multithreaded VCL application with following structure: > > - one thread holding a number of sockets receiving data > > - one server thread to provide remote control > > - one main TApplication thread, of course > > All actions with sockets are done within their owner thread. > > > > All inter-thread stuff is synchronized by events, PostMessage is used > > where possible, so I think no issues here. > > > > The question: do I need ADV_MT enabled (i.e., NO_ADV_MT defined)? It > > generates lots of locking/unlocking, which I think are excess in my > > case. Or it's safer to leave the define as is? > > If you have instances of TWSocket or descendant in different threads do > not define NO_ADV_MT. The SSL code also relies on that symbol. > However the locking around the winsock library calls are IMO wasted > processor time. This is necessary only to provide a public library > unload option which is IMO not required. Why would I want to unload > a loaded library except on application shutdown? > Possible race conditions on checking whether DLL handle or procedure > addresses were assigned or not won't hurt if the library was only > unloaded on application shutdown, or am I missing the point? > > -- > Arno Garrels > > > -- > 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 > I noticed one thing--In my 4-cores machine, when I launch 4-8 worker threads, it uses 50% CPU including the client stress tester ( http://www.fastream.com/webstresstester.php). For using up all the cores, I had to open hundreds of threads--could this be related to the winsock calls ADV_MT protection? You can use the stress tester above and http://www.iqproxyserver.com for testing with adjustable number of threads/clients. Regards, SZ -- 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