procsem

procsem
Login

procsem

An instantiated ProcSem object represents a potential sequence of operations that may be active or inactive, but can only be activated once at a time. When the ProcSem is acquired it will generate a ProcCtx object that represents ownership of the sequence of operations. The ProcSem will remain in this "owned" state until the ProcCtx is dropped.

The idea is that a process, which may span several threads/tasks, passes the ProcCtx object around for as long as a process is running to prohibit another paralell instance to be launched.

A use-case for procsem is running an update process on an embedded system, where a new firmware version needs to be uploaded to the device, then unpacked, verified and finally installed. A ProcSem can be used to protect an entire update sequence from launching more than once at a time.