Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM Client/Server » View Thread |
Messages 1 to 5 of 5 total |
Thread safe inside DLL |
Mon, Jun 11 2007 5:16 PM | Permanent Link |
"Jose Eduardo Helminsky" | Tim
If you record, I am building an application that holds DBISAM server and another multi-thread server to run remote procedures. Each thread will load a DLL and execute some actions. So far, so good. My doubt is: Should be the procedures inside DLL thread safe ? Eduardo |
Tue, Jun 12 2007 3:30 PM | Permanent Link |
"Jose Eduardo Helminsky" | Tim
Forget it. I´ve realized the code inside DLL MUST be thread safe because DLL is loaded *INSIDE* a thread. Eduardo "Jose Eduardo Helminsky" <contato@hpro.com.br> escreveu na mensagem news:A88AE53B-C41B-4ADB-A18D-19BE687E43A1@news.elevatesoft.com... > Tim > > If you record, I am building an application that holds DBISAM server and > another multi-thread server to run remote procedures. Each thread will > load a DLL and execute some actions. So far, so good. My doubt is: Should > be the procedures inside DLL thread safe ? > > Eduardo |
Tue, Jun 12 2007 6:20 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Eduardo,
<< Forget it. I´ve realized the code inside DLL MUST be thread safe because DLL is loaded *INSIDE* a thread. >> Loaded *and* executed inside a thread. -- Tim Young Elevate Software www.elevatesoft.com |
Wed, Jun 13 2007 8:53 AM | Permanent Link |
"Jose Eduardo Helminsky" | Tim
Another important thing that I realize after a day of tests is a need of using IsMultiThread := True at DLL initialization because ALL the code were thread safe but if I remove this line of code the server crashes. library dbhpro; uses FastMM4, SysUtils, rproc in 'rproc.pas'; function DisableThreadLibraryCalls(hLibModule: HMODULE): Boolean; stdcall; external 'kernel32'; function Process(cAux: PChar): ShortString; stdcall; begin // My routines end; exports Process; begin IsMultiThread := True; <----------------- Needed by a DLL loaded and executed inside a thread DisableThreadLibraryCalls(hInstance); end. Only to you know (if not) and others because I´ve spent a day googling to a solution. Eduardo |
Wed, Jun 13 2007 4:05 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Eduardo,
<< Another important thing that I realize after a day of tests is a need of using IsMultiThread := True at DLL initialization because ALL the code were thread safe but if I remove this line of code the server crashes. >> Yep. We missed this early on in the ODBC driver and had the same issue. It's very easy to miss when you're used to it auto-setting when you use the built-in threading objects. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Thursday, March 28, 2024 at 06:05 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |