> Subject: Re: [twsocket] TWSocket Digest, Vol 161, Issue 19 When replying to a "digest" message, please change the subject to something appropriate. The best is to use the same subject as before.
>> Just to be sure it is related to ICS: remove any ICS code from the DLL >> and >> run your test again. > > No, I think it is not ICS related yet, I just wanted this to be stable > *before* putting much code of ICS into it. I don't want to make the same > mistake as in the first run. Build it step by step now and test after > each step. Since it is not related to ICS but is general Windows Dll/thread programming, I suggest you post your message related to this DLL/Thread problem in the newsgroup news://news.borland.com/borland.public.delphi.nativeapi.win32 until you get the appropriate solution. >> Why worry if program crash ? A crash is a crash. > > Yes and no. If the program simply fails I don't want to have to restart > the whole PC just because of that. The dll should terminate all > connections gracefully then so that you just need to restart the failed > app. again and all is okay. When you quit an application, even with a total crash or kill the application using task manager, all connections are closed (remote peer receive "connection aborted" error code). > Hm, but it the thread is to be created only once, it's a problem if it > is created from initialize. Okay, as somebody else already told me I > shouldn't create the thread from initialize anyway. If I have changed > that I won't be a problem anyway. In the DLL you can catch evey process and thread attach and detach. This is probably the place to put your creation code. See this article: http://delphi.about.com/cs/adptips2003/a/bltip1003_2.htm Maybe this one is also interesting: http://www.mustangpeak.net/hooks_fix.htm -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be ----- Original Message ----- From: "Markus Humm" <[EMAIL PROTECTED]> To: <twsocket@elists.org> Sent: Sunday, March 26, 2006 3:10 PM Subject: Re: [twsocket] TWSocket Digest, Vol 161, Issue 19 > >> Now I wrote a simple test program which Loadlibraries the dll, waits >>> some ms and freelibraries it then and waits another few ms. This is done >>> up to 1000 times to check whether it works or not. if only done a few >>> times all is well, but when really trying to do it 1000x it crashes (the >>> app hangs) and even windows explorer is crashed so that the PC has to be >>> rebootet then. It crashes after 200-300 cycles mostly. >> >> Just to be sure it is related to ICS: remove any ICS code from the DLL >> and >> run your test again. > > No, I think it is not ICS related yet, I just wanted this to be stable > *before* putting much code of ICS into it. I don't want to make the same > mistake as in the first run. Build it step by step now and test after > each step. >> >>> - this thread has a message pump with peekmessage and pm_remove >> >> Bad. Use GetMessage or your thread will eat all CPU available to it. > > Okay, but I thought it could block events, but as they're triggered by > windows messages anyway any timers or ICS components etc. which use > events will be triggered then and run fine I assume. >> >>> How can I avoid to terminate the thread from finalize if the normal way >>> fails maybe due to a program crash? >> >> Why worry if program crash ? A crash is a crash. > > Yes and no. If the program simply fails I don't want to have to restart > the whole PC just because of that. The dll should terminate all > connections gracefully then so that you just need to restart the failed > app. again and all is okay. > >> >>> What happens if the dll is used statically and what if dynamically? >> >> No change except the time when finalize called. >> >>> What if several apps use the dll at the same time? >> >> No change. >> >>> is initialization/finalization being called several times? >> >> Yes, but with different data sections. You can ignore the fact that your >> DLL >> is loaded by several apps. > > Hm, but it the thread is to be created only once, it's a problem if it > is created from initialize. Okay, as somebody else already told me I > shouldn't create the thread from initialize anyway. If I have changed > that I won't be a problem anyway. > > Greetings > > Markus > -- > 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 -- 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