
    qi                     2    d Z ddlZddlmZ  G d de      Zy)zCEvent-based notifier implementation using asyncio Event primitives.    N)BaseNotifierc                   "    e Zd ZdZd Zd Zd Zy)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                 6    t        j                         | _        y)znInitialize the event notifier.

        Creates an internal asyncio.Event for managing notifications.
        N)asyncioEvent_eventselfs    S/opt/pipecat/venv/lib/python3.12/site-packages/pipecat/utils/sync/event_notifier.py__init__zEventNotifier.__init__   s    
 mmo    c                 @   K   | j                   j                          yw)zSignal the event to notify waiting tasks.

        Sets the internal event, causing any tasks waiting on this
        notifier to be awakened.
        N)r	   setr
   s    r   notifyzEventNotifier.notify   s      	s   c                    K   | j                   j                          d{    | j                   j                          y7 w)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
   s    r   r   zEventNotifier.wait%   s3      kk    	!s   AA  AN)__name__
__module____qualname____doc__r   r   r    r   r   r   r      s    &r   r   )r   r    pipecat.utils.sync.base_notifierr   r   r   r   r   <module>r      s    J  9L r   