fork
From the SETL Wiki
| fork | |
|---|---|
| Category | I/O |
| Syntax | function |
| Compatibility | |
| CIMS SETL | no |
| SETL-S | no |
| SETL2 | no |
| GNU SETL | yes |
Contents |
Purpose
Interface to POSIX fork() function.
Synopsis
fork
Description
Create a clone of the current system process and returns the PID of the new process.
In the child process, returns 0.
Examples
- Edit the contents of the string variable s using the user's default editor:
putfile(tmpPath := tmpnam, s); if (child := fork) = 0 then editor := getenv('EDITOR') ? '/bin/ed'; exec(editor, [filter('basename ' + pretty editor, ), tmpPath]); else waitpid(child); s := getfile(tmpPath); unlink(tmpPath); end if;

