o
    i                     @   s,   d Z ddlZddlmZ G dd deZdS )zCEvent-based notifier implementation using asyncio Event primitives.    N)BaseNotifierc                   @   s(   e Zd ZdZdd Zdd Zdd ZdS )	EventNotifiera  Event-based notifier using asyncio.Event for task synchronization.

    Provides a simple notification mechanism where one task can signal
    an event and other tasks can wait for that event to occur. The event
    is automatically cleared after each wait operation.
    c                 C   s   t  | _dS )znInitialize the event notifier.

        Creates an internal asyncio.Event for managing notifications.
        N)asyncioEvent_eventself r	   U/home/ubuntu/.local/lib/python3.10/site-packages/pipecat/utils/sync/event_notifier.py__init__   s   zEventNotifier.__init__c                    s   | j   dS )zSignal the event to notify waiting tasks.

        Sets the internal event, causing any tasks waiting on this
        notifier to be awakened.
        N)r   setr   r	   r	   r
   notify   s   zEventNotifier.notifyc                    s    | j  I dH  | j   dS )zWait for the event to be signaled.

        Blocks until another task calls notify(). Automatically clears
        the event after being awakened so subsequent calls will wait
        for the next notification.
        N)r   waitclearr   r	   r	   r
   r   %   s   zEventNotifier.waitN)__name__
__module____qualname____doc__r   r   r   r	   r	   r	   r
   r      s
    r   )r   r    pipecat.utils.sync.base_notifierr   r   r	   r	   r	   r
   <module>   s   