DelphiFAQ Home Search:
General :: Programming :: Delphi :: Windows with Delphi
Windows programming with Delphi

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Featured Article

Assign the current thread to the first CPU

Question:

My application crashes on systems with multiple CPUs or dual-core CPUs

Answer:

You probably have some re-entrancy problem. Try to force all threads to run on CPU 1. This means to put the code from below in all threads and of course in the main thread, e.g. in FormCreate().

procedure TForm1.FormCreate(Sender: TObject);
 var
   iThread : Handle;
 begin
   iThread := GetCurrentThread();
   SetThreadAffinityMask(iThread, 1);
 end;
 

Generated 4:01:38 on Feb 25, 2017