vercel-labs / vercel-labs/native

Feature request: thread-safe wake handle for external event sources

Open
#161 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Zig
Stars
7.7k
Forks
314
Avg merge
5h
Merged PRs (30d)
13

Description

Problem

Applications may receive events from long-lived external sources such as child processes, sockets, file watchers, or application-managed worker threads.

Currently, there does not appear to be a public way for such a thread to notify the UI event loop and produce a Msg. Applications must periodically poll a shared queue with a timer, even when no data is available.

This causes unnecessary updates/rebuilds and can interfere with animations such as caret blinking.

Proposed API

Please consider exposing a lightweight, thread-safe external wake handle:

const wake = try fx.externalWake(
    Effects.wakeMsg(.transport_ready),
);

// Called from an application-managed background thread.
try wake.notify();

References

Equivalent to winit's EventLoopProxy or libuv's uv_async_t

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the event-loop integration and the existing Effects API around the proposed Effects.wakeMsg(.transport_ready) call. Compare the requested behavior with winit's EventLoopProxy and libuv's uv_async_t references. Done should provide a public externalWake handle whose notify() can be called from an application-managed background thread without timer polling.

Written by the indexing model from the issue text.

Assessment

Tech stack
zig
Domain
desktop
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.