
engine_clone(+Original, +Clone, +Options)

   Clone the complete state of an engine

Arguments
   Original            Engine to be cloned (handle)
   Clone               Engine to become a clone (handle)
   Options             List of options

Type
   Engines and Threads

Description
    Make a duplicate of the Original engine by copying all its computational
    state (stacks, data, current point in execution) to the Clone engine.
    After cloning, Original and Clone have identical computational state,
    and can be independently resumed.
    
    To allow cloning, the Original engine must exist and must have stopped,
    i.e. have a status other than 'running' or 'exited'.
    The Clone engine must be either newly created, or have stopped with
    status 'false' or 'exception'.  After cloning, Clone is in the same
    state as Original.
    
    No options are currently supported.
    

Modes and Determinism
   engine_clone(+, +, +) is det

Examples
   
    ?- engine_create(Orig, []), 
       engine_resume(Orig, (writeln(hello) ; writeln(world)), true),
       engine_create(Clone, []), 
       engine_clone(Orig, Clone, []), 
       engine_resume(Clone, fail, CloneStatus),
       engine_resume(Orig, fail, OrigStatus).

    hello
    world
    world

    Orig = $&(engine,"46445b")
    Clone = $&(engine,"464b9b")
    CloneStatus = true
    OrigStatus = true
    Yes (0.00s cpu)
    

See Also
   engine_create / 2, engine_resume / 3, engine_resume_thread / 2, engine_join / 3, get_engine_property / 3
