Skip to content

rust: Port libobs/util/threading-windows.c to obs-util #356

Closed

Description

@nathan-v

Phase

Phase 4, step 6 in docs/rust-port/testing-policy.md (threading-posix.c / threading-windows.c, together). Tracker #153 lists this after platform.c. platform.c is claimed separately (#262). These two files do not share sources with that claim.

Dependencies

threading-posix.c is already swapped when ENABLE_RUST_LIBOBS is on (Linux, macOS, FreeBSD). The safe event and the Unix semaphore live in obs-util. task.c reuses them. test/cmocka/test_threading.c is the characterization test and is left unchanged. Header-inline atomics in threading-posix.h and threading-windows.h stay C.

This issue

Port util/threading-windows.c (Win32 events, semaphores, os_set_thread_name) and drop it under ENABLE_RUST_LIBOBS, reusing the Rust primitives instead of a second API. Windows Tier 1 and Tier 3 run here. POSIX Tier 2 is re-checked on a Mac after this branch is pushed to the fork; Linux Tier 2 is CI. Docker is not available on the Windows machine.

Refs #153, #45

Activity

  1. nathan-v commented on Oct 12, 2026

    @nathan-v
    ContributorAuthor

    Claiming: libobs/util/threading-windows.c (with the already-ported threading-posix.c, one unit)

    1. RED: Windows Tier 1 semaphore and event-shim tests against empty stubs (init returns -1 / try_new returns None).
    2. GREEN: Win32 event and semaphore, C shims, Tier 3 against threading-windows.c, ENABLE_RUST_LIBOBS drops util/threading-windows.c, export fragment loses the unix-only marker. task.c'''s Windows stand-in semaphore is replaced by this Sem.
    3. POSIX half stays as it is in this push. Re-run its Tier 2 on macOS after the branch is on the fork.

    First commit today. Please add the claimed label; I cannot.

    Refs #153

  2. nathan-v commented on Oct 12, 2026

    @nathan-v
    ContributorAuthor

    Windows half of this port is on nathan-v:port/threading (835bb4c93, GREEN, on top of RED 6530df04f). Not opened as a PR yet: POSIX Tier 2 still needs a recheck on macOS, and this machine has no Docker so Linux Tier 2 and the local-gate stamp were not run.

    On Windows, threading_windows (9) and threading_windows_parity (5) pass, and the task-queue tests pass on the Win32 event and semaphore. Mutation: Sem::post ignoring a failed ReleaseSemaphore made sem_post_at_max_matches fail (left 0, right -1); that break was reverted.

    Intentional difference: a NULL out-pointer after a successful CreateEvent / CreateSemaphore returns EINVAL and the kernel object is closed. C writes through the pointer. Header-inline atomics stay C. The maintainer still needs to add the claimed label.

  3. nathan-v commented on Oct 12, 2026

    @nathan-v
    ContributorAuthor

    Releasing threading-posix.c / threading-windows.c. The port merged in #389.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions