Skip to main content

splinter_madvise

Function splinter_madvise 

Source
pub unsafe extern "C" fn splinter_madvise(
    shard_id: u32,
    addr: *mut c_void,
    len: usize,
    advice: c_int,
    timeout_ticks: u64,
) -> c_int
Expand description

@brief Cooperative posix_madvise(): the voluntary-yield entry point.

Runs the election. If shard_id is sovereign, issues posix_madvise(addr,len,advice) immediately and returns its result. If not sovereign:

  • timeout_ticks == 0 -> do NOT block; return -1, errno=EAGAIN (defer).
  • timeout_ticks == UINT64_MAX -> block until sovereign, then advise.
  • else -> block up to timeout_ticks, re-electing on each wake. Blocking uses the eventfd broker when the bus owner has armed it (splinter_event_bus_open/wait); otherwise a TSC-polled nanosleep fallback.

If addr==NULL, advises the whole value arena (VALUES .. VALUES+arena_sz).

@return 0 on success (advisement issued), -1 on EAGAIN/timeout/posix_madvise failure (errno set), -2 on bad args/no store/unknown shard_id.