If are you dynamically creating and destroying threads in your app be
careful. Delphi 4 has got the same bug as all other versions in the thread
management. They all require a critical section at the indicated points.

I have also found that with using data databases that if you create a new
session for a thread this session must be created in the main thread (i.e.
use syncronize). 

I am still working through DDE issues in threads as there appears to be some
problems in this area as well.

Maurice

 
procedure AddThread;
 
  function AllocateWindow: HWND;
  var
    TempClass: TWndClass;
    ClassRegistered: Boolean;
  begin
   .
   .
  end;
 
begin
                                               <--begin critial section
required here
  if ThreadCount = 0 then
    ThreadWindow := AllocateWindow;
  Inc(ThreadCount);
                                               <--end critial section
required here
end;
 


procedure RemoveThread;
begin
                                               <--begin critial section
required here
  Dec(ThreadCount);
  if ThreadCount = 0 then
    PostMessage(ThreadWindow, CM_DESTROYWINDOW, 0, 0);
                                               <--end critial section
required here
end;

 

-----Original Message-----
From: Xander van der Merwe [mailto:[EMAIL PROTECTED]]
Sent: Monday, 3 May 1999 21:06
To: Multiple recipients of list delphi
Subject: Re: [DUG]: VCL COM Subsytem Thread Safety.


I've just recently read somewhere reliable that the COM/ActiveX VCL library
in Delphi 4 is now thread safe - obviously implying that it was not the case
under Delphi 3. I can't unfortunately remember the source though :-(

Xander van der Merwe


-----Original Message-----
From: Myles Penlington <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Date: Monday, May 03, 1999 9:04 AM
Subject: [DUG]: VCL COM Subsytem Thread Safety.


Does anybody know if the VCL COM Subsystem is thread safe?? OR if the Delphi
Exception handling is threadsafe (or not)?

Why ask?
If I create COM controls marked as "Both" or even "Free" will the standard
VCL COM stuff handle the multiple threads?

FYI: I found that to have IIS/ASP work with a OLE/COM Object and store the
object reference in the ASP application object, that I had to aggregate the
COM Free Threaded Marshaler object.

Regards

Myles Penlington
Software Engineer
ADVANCED MANAGEMENT SYSTEMS

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to