Processes

cimba.hold(duration)

Suspend the current process for duration simulated time units.

cimba.yield_process()

Yield the current process until another process, timer, or event resumes it.

cimba.wait_event(handle)

Yield the current process until the scheduled event fires or is canceled. Returns SUCCESS when the event fires and CANCELLED when it is canceled.

cimba.process_exit(value=None)

Exit the current process with an optional Python exit value while unwinding Python finally blocks normally.

cimba.current_process()

Return the currently running cimba.Process, or None outside process execution.

class cimba.Process(name, target, /, *args, priority=0, pass_process=False, **kwargs)

Named stackful Cimba process executing a Python callable. The callable is called as target(*args, **kwargs). When pass_process is true, it is called as target(process, *args, **kwargs).

name

Process name used by Cimba logging and diagnostics.

priority

Current process priority used in waiting and resource queues.

status

Current process lifecycle state.

start()

Schedule the process to start at the current simulation time and return the process object.

stop()

Request cooperative cancellation of a running Python-backed process.

interrupt(signal=INTERRUPTED, priority=0)

Interrupt a waiting process with a non-success signal.

resume(signal=SUCCESS)

Schedule a yielded process to resume with the given signal.

wait()

Wait until this process finishes, returning the wakeup signal.

timer_add(duration, signal=TIMEOUT)

Add an independent timer that resumes this process after duration.

timer_set(duration, signal=TIMEOUT)

Clear existing timers and set one timer for this process.

timer_cancel(handle)

Cancel a timer by handle.

timers_clear()

Cancel all timers currently scheduled for this process.

exit_value()

Return the Python value produced by a finished process, if any.

close()

Release the native process and any owned Python exit value.

Signals

cimba.SUCCESS
cimba.PREEMPTED
cimba.INTERRUPTED
cimba.STOPPED
cimba.CANCELLED
cimba.TIMEOUT

Lifecycle states

cimba.PROCESS_CREATED
cimba.PROCESS_RUNNING
cimba.PROCESS_FINISHED