externally-driven-async-rt 0.1.0

Async runtime that is meant to be embedded
Documentation
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) struct ThreadId(usize);

// SAFETY: matches `pthread_t pthread_self(void)` from libc, where `pthread_t` is a pointer on
// macOS (an `unsigned long` on Linux), both `usize`-sized; it has no preconditions.
#[link(name = "c")]
unsafe extern "C" {
    safe fn pthread_self() -> usize;
}

impl ThreadId {
    pub(crate) fn current() -> Self {
        Self(pthread_self())
    }

    pub(crate) fn to_raw(self) -> usize {
        self.0
    }
}