<--- Cannot embed stylesheet: [Errno 2] No such file or directory: '../../../../aros.css' --->

Process.mui

MUIA_Process_AutoLaunch

Function

Choose whether construction calls Launch.

Inputs

Initialize only. BOOL stored from the tag value. Default TRUE. No local
setter or getter.

Notes

Any nonzero value launches. Launch status is ignored, and the callback
may run before construction returns. Set FALSE to defer launch until
required initialization is complete.

MUIA_Process_Name

Function

Supply the name used for each CreateNewProc call.

Inputs

Initialize only. Borrowed terminated STRPTR, despite the header ULONG
annotation. Default NULL. No local setter or getter.

Notes

The wrapper retains the pointer without copying or freeing it. Keep it
valid for future launches. DOS copies the name for a successfully
created process; NULL omits NP_Name and uses the DOS default.

MUIA_Process_Priority

Function

Supply NP_Priority when launching the worker.

Inputs

Initialize only. LONG stored value, despite the header ULONG annotation.
Default creating task priority. No local setter or getter.

Notes

Process performs no range validation or adjustment of an already running
worker. A higher-priority worker may run before Launch returns; the
startup limitations still apply.

MUIA_Process_SourceClass

Function

Choose explicit class dispatch for the worker callback.

Inputs

Initialize only. Borrowed struct IClass pointer, despite the header
ULONG annotation. Default NULL. No local setter or getter.

Notes

Non-NULL selects CoerceMethod with SourceObject; NULL selects normal
DoMethod dispatch on SourceObject. It does not create a source object.
Keep the class and source object valid throughout the call.

MUIA_Process_SourceObject

Function

Choose the object receiving MUIM_Process_Process in the worker task.

Inputs

Initialize only. Borrowed Object pointer, despite the header ULONG
annotation. Default NULL. No local setter or getter.

Notes

A valid compatible source is required before launch; NULL is not
replaced with the Process object and is not checked before dispatch. The
object is not disposed by Process. Callback code runs in the DOS worker,
not the application task.

MUIA_Process_StackSize

Function

Supply NP_StackSize for worker creation.

Inputs

Initialize only. ULONG byte count. Default 40000. No local setter or
getter.

Notes

The wrapper passes the value to DOS without validating sufficiency for
the callback. It does not resize a running worker. Creation failure is
not reported by Launch return status.

MUIA_Process_Task

Function

Read the currently stored DOS process pointer.

Inputs

Get only. Borrowed struct Process pointer, despite the header ULONG
annotation; NULL initially and after the worker clears the field.

Result

The local getter stores the pointer and returns TRUE. It does not retain
or lock the process.

Notes

The pointer is only a snapshot and can become invalid immediately. NULL
does not prove complete DOS process exit; a fast worker can leave a
stale non-NULL value because of the launch race described by the class.
Do not dispose the process or infer safe external task access from this
getter. Unknown attribute queries first zero caller storage before
delegating to Semaphore.

MUIC_Process

Superclass

Semaphore.mui

Description

Start a DOS process that invokes MUIM_Process_Process on a supplied
source object. With SourceClass set, the worker uses CoerceMethod
through that class; otherwise it uses DoMethod on SourceObject. Supply a
valid source object implementing the worker method before launch.
Neither source object nor source class is owned, copied or kept alive by
a reference.
The superclass is Semaphore, which derives from rootclass, not Notify.
The inherited semaphore methods are available, but Process does not
acquire that semaphore around its own state. This class does not
implement Notify-style attribute notifications, automatic UI marshalling
or thread-safe object access.
Construction defaults AutoLaunch to TRUE, stack size to 40000 bytes and
priority to the creating task's priority. With automatic launch, the
worker can execute before construction returns. Constructor success does
not prove successful process creation. Use AutoLaunch FALSE when the
source needs additional initialization before starting.
Disposal calls Kill with maxdelay zero and waits without a timeout
before delegating disposal. The source implementation must cooperate
with cancellation and return. Do not dispose this object or call its
waiting Kill from its own worker, or while holding resources that worker
needs to finish. Keep the source, class and process object alive until
worker use has ended.

Bugs

The worker clears the task field after its source method returns, before
the DOS process has completely exited. NULL is therefore not a native
process-termination acknowledgement. The class supplies no synchronized
startup/exit handshake or task-lifetime reference.
Launch assigns CreateNewProc's result to the task field and only then
clears kill. A worker can run before this assignment and, if it returns
quickly, clear the field before Launch overwrites it with the returned
process pointer. On relaunch it can also observe the previous kill value
before Launch resets it. A non-NULL field can consequently be stale;
Task, Signal and Kill are not race-free lifetime operations. This
implementation does not provide a general safe join guarantee.

MUIM_Process_Kill

Synopsis

IPTR result = DoMethod(obj, MUIM_Process_Kill, maxdelay);

Function

Request cooperative termination and poll the stored task pointer.

Inputs

maxdelay - LONG nominal delay limit in DOS ticks, each 1/50 second. Zero
means wait without a limit. Use a nonnegative value; negative values are
not validated and interact with the unsigned delay counter.

Result

TRUE if polling finishes without taking the timeout branch; FALSE if
accumulated delay exceeds a nonzero maxdelay. No forced task removal
occurs.

Notes

Set kill to one even when there is no worker. While the task field is
non-NULL, send SIGBREAKF_CTRL_C, Delay(10), add ten to the delay
counter, then compare using strictly greater than. A limit of ten
therefore allows two delays before timeout if the field stays non-NULL.
Scheduler delays may extend elapsed wall time. Timeout is checked before
the next task-field check, so FALSE can occur even if the worker cleared
the field during the final delay.
On timeout, kill remains one and the worker may still run. Keep all
referenced objects alive. This call does not pump application input,
protect task lifetime or forcibly interrupt arbitrary blocking work. A
stale task pointer can invalidate the operation; see class limitations.
Never call a waiting Kill from the worker it is waiting for.

MUIM_Process_Launch

Synopsis

IPTR result = DoMethod(obj, MUIM_Process_Launch);

Function

Create a worker when the stored task pointer is NULL.

Inputs

obj - Live Process object with valid source object/class and borrowed
launch data.

Result

Always TRUE, including CreateNewProc failure and an already non-NULL
task field.

Notes

CreateNewProc receives entry, stack size, optional name, priority and
instance data as NP_UserData. After the call, Launch stores the returned
pointer and sets kill to zero. No startup acknowledgement is awaited. If
the pointer was already non-NULL, the method does nothing and does not
reset kill. See the class startup race; return TRUE is not proof that a
worker is running.

MUIM_Process_Process

Synopsis

IPTR result = DoMethod(source, MUIM_Process_Process, kill, proc);

Function

Provide the source object worker entry point invoked by Process.

Inputs

kill - Borrowed pointer to the Process instance ULONG cancellation flag.
proc - Borrowed Process MUI object, not a DOS task pointer. Both must
remain valid during the callback.

Result

The worker ignores the callback result. The base Process implementation
only delegates this message to Semaphore and implements no work loop.

Notes

Implement this method in the chosen source object/class. It runs in the
newly created DOS process. Cooperate with the shared kill flag and
SIGBREAKF_CTRL_C, release acquired resources and return to allow the
wrapper to clear its task field. Wait for suitable events rather than
continuously polling. The wrapper provides neither synchronization of
shared application data nor automatic dispatch to the UI task; use the
appropriate AROS ownership and messaging rules. Do not free or retain
the supplied instance pointers beyond their lifetime.

MUIM_Process_Signal

Synopsis

IPTR result = DoMethod(obj, MUIM_Process_Signal, sigs);

Function

Send an Exec signal mask to the stored worker task if non-NULL.

Inputs

sigs - ULONG signal-bit mask, not a signal number. obj must remain live.

Result

Always zero; no delivery acknowledgement or error status.

Notes

The method does not set the kill flag and does nothing for a NULL task
field. Checking the field and calling Signal are not protected against
concurrent worker exit or the launch race. The caller must not treat
this operation as a task-lifetime guard.