# Path: src/pegl/ext/khr_sync.py
# NO_SYNC = c_void_p(0)
# FOREVER = 0xFFFFFFFFFFFFFFFF
#     SYNC_STATUS = 0x30F1
#     SYNC_TYPE = 0x30F7
#     SYNC_CONDITION = 0x30F8
#         TIMEOUT_EXPIRED, CONDITION_SATISFIED = 0x30F5, 0x30F6
# class WaitFlags(BitMask):
# class SyncAttribs(Attribs):
# class Sync:
# class ReusableSync(Sync):
# class FenceSync(Sync):
#     def __init__(self, display, attribs):
#     def _create_handle(self):
#     def __del__(self):
#     def _as_parameter_(self):
#     def _attr(self, attr):
#     def status(self):
#     def sync_type(self):
#     def signaled(self):
#     def client_wait(self, timeout_ns=FOREVER, flush_commands=False):
#     def __init__(self, display):
#     def signal(self, signaled=True):
#     def __init__(self, display):
#     def sync_condition(self):
# 
# Path: src/pegl/native.py
# def make_int_p(ival=0):
# def error_check(fn, fail_on=None, always_check=False, fallback_error=EGLError,
#                 fallback_msg=None, fail_on_null=False):
#     def wrapped_fn(*args, **kwargs):


from ctypes import c_int
from .khr_sync import c_sync, Sync, SyncAttribs
from ..native import c_display
# New Sync subclass.
class NativeFenceSync(Sync):
    '''Represents the "native fence" type of sync object.

    Class attributes:
        extension -- The name string of the native fence sync extension.
        sync_type -- SyncTypes.FENCE.

    Instance attributes:
        synchandle, display, status, signaled, sync_type -- As per the
            superclass, Sync.
        attribs -- Always an empty AttribList.
        fd -- The file descriptor associated with this sync object.
        sync_condition -- The condition under which this sync object
            will be automatically set to signaled. Should always be the
            value 0x3146 (decimal 12614), indicating "native fence
            signaled".

    '''
    extension = 'EGL_ANDROID_native_fence_sync'
    sync_type = NATIVE_FENCE

    def __init__(self, display, fd=NO_NATIVE_FENCE_FD):
        '''Create the fence sync object.

        Keyword arguments:
            display -- As the instance attribute.

        '''
        # Native fence sync objects have only one attribute.

# Path: src/pegl/ext/khr_sync.py
# NO_SYNC = c_void_p(0)
# FOREVER = 0xFFFFFFFFFFFFFFFF
#     SYNC_STATUS = 0x30F1
#     SYNC_TYPE = 0x30F7
#     SYNC_CONDITION = 0x30F8
#         TIMEOUT_EXPIRED, CONDITION_SATISFIED = 0x30F5, 0x30F6
# class WaitFlags(BitMask):
# class SyncAttribs(Attribs):
# class Sync:
# class ReusableSync(Sync):
# class FenceSync(Sync):
#     def __init__(self, display, attribs):
#     def _create_handle(self):
#     def __del__(self):
#     def _as_parameter_(self):
#     def _attr(self, attr):
#     def status(self):
#     def sync_type(self):
#     def signaled(self):
#     def client_wait(self, timeout_ns=FOREVER, flush_commands=False):
#     def __init__(self, display):
#     def signal(self, signaled=True):
#     def __init__(self, display):
#     def sync_condition(self):
# 
# Path: src/pegl/native.py
# def make_int_p(ival=0):
# def error_check(fn, fail_on=None, always_check=False, fallback_error=EGLError,
#                 fallback_msg=None, fail_on_null=False):
#     def wrapped_fn(*args, **kwargs):


# Path: src/pegl/ext/android_nativesync.py
from ctypes import c_int
from .khr_sync import c_sync, Sync, SyncAttribs
from ..native import c_display

# New Sync subclass.
class NativeFenceSync(Sync):
    '''Represents the "native fence" type of sync object.

    Class attributes:
        extension -- The name string of the native fence sync extension.
        sync_type -- SyncTypes.FENCE.

    Instance attributes:
        synchandle, display, status, signaled, sync_type -- As per the
            superclass, Sync.
        attribs -- Always an empty AttribList.
        fd -- The file descriptor associated with this sync object.
        sync_condition -- The condition under which this sync object
            will be automatically set to signaled. Should always be the
            value 0x3146 (decimal 12614), indicating "native fence
            signaled".

    '''
    extension = 'EGL_ANDROID_native_fence_sync'
    sync_type = NATIVE_FENCE

    def __init__(self, display, fd=NO_NATIVE_FENCE_FD):
        '''Create the fence sync object.

        Keyword arguments:
            display -- As the instance attribute.

        '''
        # Native fence sync objects have only one attribute.

        super().__init__(display, {SyncAttribs.NATIVE_FENCE_FD: fd})