Hello,

the following program is throwing an Access Violation on my system (ARM920T, uClibc):

program project1;
{$mode objfpc}{$H+}
uses
  cthreads, SysUtils;

function TheThread(pAnyArgument: Pointer): Longint;
begin
   repeat
      Sleep(1000);
   until FALSE;
end;

begin
   Writeln('Running...');
   BeginThread(@TheThread, NIL);
   repeat
   until FALSE;
end.

This is the error output:

# ./project1
Running...
An unhandled exception occurred at $40082E50 :
EAccessViolation : Access violation
  $40082E50 of ../objpas/sysconst.pp
$0001CA04 BEGINTHREAD, line 104 of D:/fpc231/9749/src/rtl/inc/thread.inc
  $0001C988  BEGINTHREAD,  line 81 of D:/fpc231/9749/src/rtl/inc/thread.inc
  $00010434  main,  line 21 of project1.pas
  $4005D6B4 of ../objpas/sysconst.pp

I crosscompiled the program with fpc 2.3.1 and following parameters:

ppcrossarm.exe -S2cgi -TLinux -Parm -gl -vewnhi -l -Fu. -oproject1 -XRpathtodynlinker\gcc-4.1.2-uclibc


I tried to debug this and am stuck now in cthreads.pp. line 289:

if pthread_create(ppthread_t(@threadid), @thread_attr, @ThreadMain,ti) <> 0 then

The program is crashing within the execution of pthread_create
Using pthreads alone is working fine BTW. I can live with pthreads, but I would like to know, what is going wrong. Thanks for any hints and pointers.

Regards, Bernd.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to