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:

2012-10-29, 02:29:50
anonymous from China  
2015-02-01, 01:15:49
anonymous  
IMHO you've got the right anewrs!
2015-02-01, 04:54:05
anonymous  
Your answer was just what I nedede. It's made my day!
2015-03-07, 20:28:35
anonymous from Indonesia  
INGIN MERASAKAN KEMENANGAN DI DALAM BERMAIN TOGEL TLP KI ANGEN JALLO DI NMR (_0_8_5_2_8_3_7_9_0_4_4_4_) JIKA INGIN MENGUBAH NASIB KAMI SUDAH 7X TERBUKTI TRIM’S ROO,MX SOBAT

 

 

NEW: Optional: Register   Login
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, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

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.

photo Add a picture: