mp.tasks.vision.drawing_styles.face_landmarker.serial_dispatcher.SerialDispatcher

A wrapper class for a ctypes.CDLL object that serializes all calls.

This ensures that functions from a non-thread-safe C library are called sequentially from a single dedicated thread, preventing race conditions and segmentation faults.

If a function is a CStatusFunction, the dispatcher will raise a Python exception if the returned MpStatus code is not kMpOk.

lib The ctypes.CDLL object to wrap.
signatures the CFunction objects specifying the functions to wrap.

Methods

close

View source

Shuts down the dispatcher and waits for pending tasks to complete.

__enter__

View source

__exit__

View source