Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2008-01

arm-linux, using unit cthreads fails

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bernd Mueller

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.

Reply by email