0 Members and 1 Guest are viewing this topic.
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <utility/tagitem.h>#include <exec/ports.h>#include <dos/dos.h>#include <dos/dostags.h>/* Protos */#include <clib/exec_protos.h>#include <clib/dos_protos.h>#include <clib/alib_protos.h>void CllFnc(void);int main (int argc, char **argv){ struct Process *Proc; struct TagItem PrcTgs[5]; PrcTgs[0].ti_Tag = NP_Entry; PrcTgs[0].ti_Data = (ULONG)CllFnc; PrcTgs[1].ti_Tag = NP_Name; PrcTgs[1].ti_Data = (ULONG)"TestProcessName"; PrcTgs[2].ti_Tag = NP_Output; PrcTgs[2].ti_Data = Output(); PrcTgs[3].ti_Tag = NP_CloseOutput; PrcTgs[3].ti_Data = FALSE; PrcTgs[4].ti_Tag = TAG_DONE; if (!(Proc = CreateNewProc(PrcTgs))) printf("Thread creation error!!!\n"); else printf("Thread creation successfull\n");Delay(200); /* Wait 4 seconds. Normally a WaitPort or Wait should be used, */exit(0); /* but this is just a shrinked piece of code to reproduce the bug */}/* Function caller */void CllFnc(void){ Forbid(); printf("Test text working!!!\n");}
Can a regular Process with no children or parents, do a Forbid() without Permit() near the end?For example a CLI command?
Permit() is not needed at the end of a subprocess. In fact, it's often useful to avoid the parent being allowed to run before the subprocess has terminated.
If you are lucky enough not to be screwed by the process cleanup routines if the they do something which calls Wait() and breaks Forbid() state.
Piru wrote:Screwed how? The execution is inside the OS now, and will not return to the seglist, so the seglist can disappear as soon as the final 'rts' has executed.
Is stdio "Resident safe"?