[fpc-pascal] problem with threads and backgrounding, fpc 2.1.3 arm native
luca at ventoso.org
Thu Apr 5 00:11:54 CEST 2007
En/na Luca Olivetti ha escrit:
> OTOH my real program, even if cross-compiled (what a pain!), is still
> throwing an exception if I use ctrl-z, is still having problems with
> fork but at least (if I leave it in the foreground) I can use ctrl+c.
This is another test program that shows my problem with fork: as soon as
I start the thread, the main program stops working (the thread *is*
running, you can put a writeln in its loop to show it). Note that in
this short example I don't close stdin,stdout,stderr, I don't block
signals but it doesn't matter (I did it all and the result is the same).
The same happens with the native compiler and the cross compiler.
Now, if I remove the fork part, both the thread and the main loop work,
but if I use crtl-z and then fg after the thread has started it will
give an EAccessViolation, but this only with the native compiler (remind
that the native compiler is 2.1.3 while the cross compiler is 2.0.4).
while not terminated do sleep(1000);
if t<0 then
if t>0 then Halt(0); //parent
while true do
if i=5 then mt:=tmt.create(false);
More information about the fpc-pascal