Waking from Threadmare

Latest downloads (zip files, about 35Kb each)

I was not able to prepare D2 version - there is nothing to it, but nobody around has a compiler available:-(. Please let me know if you really need it and we'll figure something out.


Sample program gives a fatal exception when thread is cancelled.  Works fine in debug mode

(First reported by Kim Freeborn - thanks, Kim!)

This problem happens only in threaded mode within the except part of the Execute method

procedure TTestThread.Execute;
begin
  try // for except
    TestRun(FLogClient, FTotalCount, FLocalCount, FTotalSleep, FLocalSleep);
  except // some error occurred
    on e: exception do
      FLogClient.ReportAlways(e.Message);
  end; // try-except
end;

The source of the problem is that by this time all the thread-associated resources are released, so there is no "current pid" at this point. 

Fix is rather simple, though. Please replace the line with

FLogClient.ReportAlways(e.Message, exceptclass(e.classtype), pidMain);

or simply with

FLogClient.ReportAlways(e.Message, nil, pidMain);

You can apply this change yourself or you can download latest version of source code (zip file, 35Kb) from here.


Sample program won't compile under Delphi 3/4

(First reported by Olav Lindkjølen with D3 - thanks, Olav!)

D3 lacks lots of D5 niceties - default parameters, overload functions, etc. That were the primary reasons why this code wasn't originally "ported" to D3. However, due to a number of requests from fellow developers, I spent some extra time and created versions for all modern 32-bit compilers (D3-D5). Now you can download zip files (approximately 35Kb) for both  Delphi3 and Delphi4. Hope it'll help!


Home