[DUG] Coinitialise - the rules in threads

Leigh Wanstead leighw at softtech.co.nz
Fri May 5 12:59:37 NZST 2006


Hi Phil,

Here is what I did in Indy TCPServerExcute routine.

    try
      {
        Each web module will be in a seperate thread. We need to initialize
        the COM subsystem for each thread
      }
      CoInitialize(nil);

	{
		do your stuff
	}

    finally
      CoUninitialize;
    end;

Regards
Leigh
www.smootharm.com

-----Original Message-----
From: delphi-bounces at ns3.123.co.nz
[mailto:delphi-bounces at ns3.123.co.nz]On Behalf Of Phil Scadden
Sent: Friday, 5 May 2006 11:56 a.m.
To: nZ Borland Developers Group - Delphi List
Subject: [DUG] Coinitialise - the rules in threads


A Service with a TCPService stopped working suddenly when all I thought
I had done was change the default port it listened on. However the error
is interesting - it complains that Coinitialise has not been called.

Hmm.

The main service thread calls Coinitialise and establishs a global
ADO connection object.

Each listener thread on the TCP service certainly manipulates the
ADO connection but I cant see why each thread would need Coinitialise???
Why did work earlier? 

very puzzled at moment.

----------------------------------------------------------
Phil Scadden, Institute of Geological and Nuclear Sciences
764 Cumberland St, Private Bag 1930, Dunedin, New Zealand
Ph +64 3 4799663, fax +64 3 477 5232

_______________________________________________
Delphi mailing list
Delphi at ns3.123.co.nz
http://ns3.123.co.nz/mailman/listinfo/delphi




More information about the Delphi mailing list