•  Back 
  •  GEMDOS Function Reference 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  %About 
  •  Show info about hypertext 
  •  View a new file 
Topic       : The ATARI Compendium
Author      : Scott Sanders / JAY Software
Version     : 1.25 (20/6/2003)
Subject     : Documentation
Nodes       : 1117
Index Size  : 32614
HCP-Version : 6
Compiled on : Atari
@charset    : UTF-8
@lang       : en
@default    : 
@help       : %About
@options    : +g -i -t4 +y +z
@width      : 100
View Ref-FilePexec()
Pvfork()
Pfork()                                                              GEMDOS

Syntax

WORD Pfork( VOID )

Function      Pfork() creates a copy of the current process.

Opcode        283 (0x11B)

Availability  This function is available under all MiNT versions
              integrated with MultiTOS.

Binding       move.w   #$11B,-(sp)
              trap     #1
              addq.l   #2,sp

Return Value  Pfork() returns the new process ID in the parent and a 0 in
              the child.

Caveats       If the parent is in supervisor mode when this call is made,
              the child is started in user mode anyway.

Comments      After a Pfork() call, two instances of one process will
              exist in memory. Program execution in both processes
              continue at the same point in the TEXT segment following
              this call. The parent's DATA and BSS segments are physically
              copied so that any variables that change in the child will
              not affect the parent and vice versa. New processes started
              with this call should not call Mshrink() but are required to
              do any GEM initialization such as appl_init() and v_opnvwk()
              again (if GEM usage is needed). Both the parent and child
              use Pterm() or Pterm0() to terminate themselves.

See Also      Pexec(), Pvfork()