v0.4.0 - noticeboard#10
Merged
matajoh merged 1 commit intomicrosoft:mainfrom Apr 24, 2026
Merged
Conversation
5dd5113 to
e916d8e
Compare
01be31e to
c025954
Compare
Signed-off-by: Matthew A Johnson <matthew@matthewajohnson.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Noticeboard, distributed scheduler, and a relocated examples package.
New Features
behaviors can read and write without acquiring cowns. Writes
(
notice_write,notice_delete) are non-blocking; reads(
noticeboard,notice_read) return a cached snapshot taken onceper behavior execution. Atomic read-modify-write is available via
notice_update, which accepts a picklable function and an optionaldefault. Returning the
REMOVEDsentinel from the update functiondeletes the entry. Mutations are serialized through a single
dedicated noticeboard thread so the C-level read-modify-write stays
consistent without forcing behaviors to take a mutex.
notice_sync— new public API that blocks until the caller'sprior
notice_write/notice_update/notice_deletemutationshave been committed, providing a read-your-writes barrier for code
that hands work off to a subsequent behavior.
noticeboard_version— new public API returning a global,monotonic version counter that increments on every successful
noticeboard commit. Useful as a cheap change-detection hint without
taking a full snapshot.
removed. Two-phase locking, request linking, and dispatch now run
in C (
BehaviorCapsule.schedule) directly on the caller's thread,and cown release runs on the worker thread that just executed the
behavior. Waiters are tracked with an MCS-style intrusive linked
list per cown, so resolving a behavior hands off straight to the
next waiter without bouncing through any central queue. The
C-level terminator is now the only pending counter.
Cown.exceptionproperty — new boolean property onCownthatindicates whether the held value is the result of an unhandled
exception. Workers now call
set_exceptioninstead ofset_resultwhen a behavior raises.
examples/prime_factor.py, entry pointbocpy-prime-factor) — demonstrates parallel factorisation usingPollard's rho algorithm with early termination coordinated via the
noticeboard.
examples/benchmark.py, entry pointbocpy-bench) — a new micro-benchmark suite covering schedulingthroughput, message-queue latency, and noticeboard contention.
Bug Fixes
visit_Importandvisit_ImportFromnow track the alias name (
import X as Y/from X import Y as Z)instead of the original name, preventing spurious "name not found"
errors and duplicate
whencallinjection.@whenclosure capture now falls backto
frame.f_globalswhen a name is not found in any local scope,fixing
NameErrorfor module-level variables used inside behaviors.Improvements
code (
SRWLock/pthread/C11mtx_t) is now wrapped behind aunified
BOCMutex/BOCCondinline API, reducing#ifdefclutterand simplifying future platform work.
MatrixC methods now carry built-indocstrings visible to
help()and Sphinx autodoc.noticeboard cache before each behavior and on shutdown, preventing
stale reads across behaviors.
src/bocpy/examples/to a top-levelexamples/directory, mappedback into the
bocpy.examplespackage via[tool.setuptools.package-dir]. Console-script entry points areunchanged.
setup.pynow strips<!-- pypi-skip-start -->...<!-- pypi-skip-end -->regions fromREADME.mdbefore publishing, so unsupported content (e.g. Mermaiddiagrams) does not appear as raw text on PyPI. The project metadata
switches to
dynamic = ["readme"]to enable this.README.md,sphinx/source/index.rst,and
sphinx/source/api.rsthave been substantially expanded tocover the noticeboard, the distributed scheduler model, and the new
public APIs.
thinking-in-bocskill — guidance for writing BOC codewithout reaching for classical synchronization primitives.
Tests
test/test_noticeboard.py— new suite covering snapshotsemantics,
notice_updateatomicity,REMOVED,notice_sync,and version-counter monotonicity.
test/test_scheduling_stress.py— new stress suite for thedistributed scheduler covering 2PL ordering, duplicate-cown
handling, exception propagation, and high-fan-out workloads.
test/test_transpiler.py— new direct tests for AST extraction,capture rewriting, aliased imports, and module export.
Fixes #9