[fpc-pascal] Re: GetAffinity\SetAffinity

Jeppe Græsdal Johansen jeppe at j-software.dk
Fri Nov 22 19:16:25 CET 2013

Den 22-11-2013 16:21, Brian skrev:
> Mark ... sorry for the mixup. The program and unit should now be stand alone.
> The unit links libc (rev6).
> Regards
> Brian
> coret.pas
> <http://free-pascal-general.1045716.n5.nabble.com/file/n5717549/coret.pas>
> test_threads.pas
> <http://free-pascal-general.1045716.n5.nabble.com/file/n5717549/test_threads.pas>
Your code is broken.

You are using the console output from two threads simultaneously without 
proper locking. That's most likely what's causing the crash.

The critical sections you are using only protect each thread against 
itself, meaning they basically do nothing. Being inside a critical 
section is not a guarantee that you won't get preempted, but just that 
no other threads can enter the same section.

More information about the fpc-pascal mailing list