DelphiFAQ Home Search:

Assign the current thread to the first CPU

 

commentsThis article has not been rated yet. After reading, feel free to leave comments and rate it.

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;

Comments:

 

 

Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option.
 
It seems that you are
from Washington, US .

Info/ Feedback on this

Show city and country
Show country only
Hide my location
Leave your comment here:
Please type in the code:
photo Add a picture:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity. The owner of this web site reserves the right to delete such material.