libvmz: decouple the C ABI from the global run loop #30

Open
opened 2026-05-22 10:38:14 +00:00 by rc · 0 comments
Owner

Problem:

  • libvmz exposes vmz_run_loop, which blocks the caller on the platform run loop.
  • The library currently expects the consumer to enter this run loop after vmz_start.

Why this is bad:

  • Embedders may already own an event loop or UI/application lifecycle.
  • A library forcing a global blocking run loop is awkward outside the CLI.
  • This makes the C ABI feel like a process-level bridge rather than a reusable library.

Suggested fix:

  • Keep the CLI convenience if useful, but separate it from the core ABI.
  • Consider exposing integration hooks or documenting that callers must run the main run loop themselves.
  • For the CLI, wrap run-loop management outside the public libvmz API.

Relevant code:

  • lib/libvmz.h: vmz_run_loop blocks indefinitely.
  • lib/libvmz.swift: vmz_run_loop calls RunLoop.current.run().
  • src/vmz.zig: runErr calls vmz_run_loop after vmz_start.
Problem: - libvmz exposes vmz_run_loop, which blocks the caller on the platform run loop. - The library currently expects the consumer to enter this run loop after vmz_start. Why this is bad: - Embedders may already own an event loop or UI/application lifecycle. - A library forcing a global blocking run loop is awkward outside the CLI. - This makes the C ABI feel like a process-level bridge rather than a reusable library. Suggested fix: - Keep the CLI convenience if useful, but separate it from the core ABI. - Consider exposing integration hooks or documenting that callers must run the main run loop themselves. - For the CLI, wrap run-loop management outside the public libvmz API. Relevant code: - lib/libvmz.h: vmz_run_loop blocks indefinitely. - lib/libvmz.swift: vmz_run_loop calls RunLoop.current.run(). - src/vmz.zig: runErr calls vmz_run_loop after vmz_start.
Sign in to join this conversation.
No labels
highprio
lowprio
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rc/vmz#30
No description provided.