List Archives > 
Maple User Group List Archive > 
Archive by date > 
This Month By Date > 
This Month By Topic
[MUG] Maple 7: `process[forck]' in batch mode
| [MUG] Maple 7: `process[forck]' in batch mode |
|
Author: Jerome BENOIT
Posted: Mon, 05 Aug 2002 21:14:30 +0300
|
>> From: Jerome BENOIT "benoit"
Bonjour,
when I launch in batch mode the attached Maple 7 script
(maple -q dummy.mbj) the subprocess does not `quit' properly:
it continues to run (according to Linux) and the parent process
continues to `wait'. I can overround this by commentting the `quit' line
and uncommentting the `##adhoc##' lines.
Nevertheless,
I wonder what is going wrong with my code which is very near to the one
suggested in the "on-lines".
Any idea ?
Thank in advance,
Jerome BENOIT
## `dummy.mbj' Maple 7 Batch Job file
##
macro(FavoriteProcedure=sqrt):
if not assigned(tempfilename) then
tempfilename:=proc() op(sscanf(op(2,ssystem("tempfile")),"%s\n")) end;
fi;
MyFavoriteProcedure:=proc()
local dum,fd,PID,answer;
if type(evalf([args]),list(float)) then
dum:=tempfilename();
print(dum);
answer:=FAIL;
PID:=process[fork]();
if (PID=0) then
answer:=FavoriteProcedure(args);
fd:=fopen(dum,WRITE,TEXT);
fprintf(fd,"%a",answer);
fclose(fd);
ssystem(sprintf("mv %s %s.done",dum,dum));
quit;
## answer:=ssystem("echo $PPID");##adhoc
## answer:=op(sscanf(op(2,answer),"%d"));##adhoc
## ssystem(sprintf("kill -KILL %d",answer));##adhoc
else
process[wait]();
dum:=sprintf("%s.done",dum);
fd:=fopen(dum,READ,TEXT);
answer:=fscanf(fd,"%a");
answer:=op(answer);
fclose(fd);
ssystem(sprintf("mv %s %s.read",dum,dum));
fi;
answer
else 'procname'(args) fi;
end:
## test
for i from 1 to 5 do
print(MyFavoriteProcedure(i));
od;
quit;
##
## vim:syntax=maple:
##
## End of file `dummy.mbj'.
|
[View Complete Thread]
Previous by date: [MUG] Maple 7 under Linux: memory trouble, Jerome BENOIT
Next by date: [MUG] gradient of a vector field, Rob Scott
Previous thread: [MUG] hfarray --> Maple float, Dr George Corliss
Next thread: [MUG] gradient of a vector field, Rob Scott
|