How carbonengine/scheduler works
carbon-scheduler is a Python-accessible cooperative scheduler for Greenlet coroutines, with scheduling behavior intended to resemble Stackless Python. The principal workflow is to create and bind tasklets, run or yield through a thread-local schedule manager, and exchange values or exceptions through channels; QueueChannel adds buffered, nonblocking sends. The graph also shows the Python extension boundary and C API. Source excerpts are partial, so some internal links and documented capabilities are not wired where the caller could not be confirmed.
Main entry points: SchedulerModule.cpp Extension module · Tasklet.cpp Tasklet runtime · ScheduleManager.cpp Schedule manager · Channel.cpp Channel runtime
Components 13
Python interface
- Scheduler package
python/scheduler/__init__.py - Extension module
src/SchedulerModule.cpp - Tasklet binding
src/PyTasklet.cpp - Channel binding
src/PyChannel.cpp - Manager binding
src/PyScheduleManager.cpp - C API
include/Scheduler.h
Scheduling runtime
- Schedule manager
src/ScheduleManager.cpp - Tasklet runtime
src/Tasklet.cpp
Tasklet communication
- Channel runtime
src/Channel.cpp - QueueChannel
python/scheduler/__init__.py
Runtime integrations
- Greenlet runtime
Other components
- Python caller
- C API client
Connections 17
- Python caller → Scheduler package: uses
- Scheduler package → Extension module: imports
- Extension module → Schedule manager: calls
- Extension module → Tasklet binding: exposes
- Extension module → Channel binding: exposes
- Extension module → Manager binding: exposes
- Tasklet binding → Tasklet runtime: delegates to
- Channel binding → Channel runtime: delegates to
- Manager binding → Schedule manager: wraps
- Schedule manager → Tasklet runtime: switches
- Tasklet runtime → Schedule manager: schedules with
- Tasklet runtime → Greenlet runtime: switches context
- Tasklet runtime → Channel runtime: unblocks through
- Channel runtime → Schedule manager: resumes scheduler
- QueueChannel → Channel runtime: extends
- C API client → C API: uses
- C API → Extension module: imports capsule