overview

command
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Example: sync package overview

The ndk/sync package provides Go bindings for Android's native sync framework (sync fences / sync file descriptors).

Android sync fences are kernel-level synchronization primitives used to coordinate GPU and display operations. A sync fence represents a point in time on a GPU command stream — it signals when all commands submitted before it have completed.

Typical usage in the graphics pipeline:

  1. GPU driver creates a fence when submitting work
  2. Fence fd is passed to SurfaceFlinger / HWC
  3. Consumer waits on the fence before reading the buffer
  4. This enables pipelined rendering without CPU stalls

The sync fence API operates on file descriptors:

  • sync_merge(name, fd1, fd2) — merge two fences into one
  • sync_wait(fd, timeout_ms) — block until fence signals
  • sync_file_info(fd) — query fence metadata

Sync fences are typically obtained from EGL (eglDupNativeFenceFD), Vulkan (vkGetFenceFdKHR), or AHardwareBuffer operations.

This program must run on an Android device.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL