epics-libcom

Provide OS-independent EPICS module primitives for threading, synchronization, timing, and lifecycle integration.

1|1|Updated Apr 14, 2026
One-click install
npx skills add https://github.com/BCDA-APS/opencode-skills --skill epics-libcom
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: epics-libcom
Source: https://github.com/BCDA-APS/opencode-skills/tree/main/epics-libcom
Command: npx skills add https://github.com/BCDA-APS/opencode-skills --skill epics-libcom

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

EPICS module developers need reliable, OS-independent building blocks for concurrency, timing, inter-thread communication, and lifecycle integration.

Core Features & Use Cases

  • Threading with epicsThread: Create runnable threads, manage priorities and stack sizes, and use one-time initialization and thread-local storage.
  • Synchronization & messaging: Use epicsMutex, epicsEvent, and epicsMessageQueue for safe coordination between threads.
  • Performance-oriented data structures: Apply epicsRingPointer and epicsRingBytes for lock-free or bounded buffering patterns.
  • Timers, time, and observability: Schedule periodic work with epicsTimer, handle timestamps with epicsTime, and log issues via errlog.
  • IOC integration primitives: Register IOC shell commands, init hooks, exit handlers, and subroutine/aSub functions to wire logic into IOC lifecycles.
  • Networking portability (osiSock): Abstract socket creation and address conversion for cross-platform support.

Quick Start

Ask the AI to generate a minimal, production-style EPICS module snippet that uses an epicsThread worker plus an epicsEvent-driven shutdown, logs startup/shutdown with errlog, and registers an iocsh command for toggling the worker behavior.

Frequently Asked Questions about epics-libcom

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a thread-safe EPICS module with epicsThread and epicsEvent?

Use epicsThread to spawn worker threads and epicsEvent to signal safe startup or shutdown transitions. Combine this with epicsMutex to protect shared state, ensuring robust concurrent IOC module behavior.

What is the best way to pass data between EPICS worker threads?

Use epicsMessageQueue for blocking producer/consumer coordination, or apply epicsRingPointer and epicsRingBytes for bounded, performance-oriented buffering that minimizes lock contention between threads.

How does epicsTimer handle periodic scheduling in an IOC?

epicsTimer schedules periodic callbacks within the IOC environment, relying on epicsTime for precise timestamp handling. This enables cross-platform periodic task execution without OS-specific timing dependencies.

Can I register custom iocsh commands and exit handlers in my EPICS module?

Yes, you can register iocsh commands, initHooks, and exit handlers to wire custom logic into the IOC lifecycle. This enables shell-level control of worker behavior and guarantees safe shutdown procedures.

When should I use epicsThread once-only initialization and thread-local storage?

Use epicsThread once-only initialization and thread-local storage when multiple threads attempt to initialize shared resources concurrently. This prevents race conditions during startup and maintains isolated per-thread state.

Does libCom provide OS-independent socket abstraction for EPICS networking?

Yes, libCom provides osiSock to abstract socket creation and address conversion. This ensures cross-platform networking support, allowing EPICS modules to handle connections without OS-specific socket code.