
    fk                     ^    d Z ddlmZmZ ddlmZmZmZ ddlm	Z	 ddlm
Z  G d d      ZdgZy	)
zzmq Context class    )EINVAL
IO_THREADS)InterruptedSystemCallZMQError	_check_rc   )ffi)libc                   V    e Zd ZdZdZdZdZd
dZed        Z	ed        Z
d Zd Zd	 Zy)ContextNTFc                    |r#t        j                  d|      | _        d| _        n4d| _        |dk\  st	        t
              t        j                         | _        | j                  t         j                  k(  rt	        t        j                               |s%t        j                  | j                  t        |       d| _        y )Nzvoid *TFr   )r	   cast_zmq_ctx_shadowr   r   Czmq_ctx_newNULL	zmq_errnozmq_ctx_setr   _closed)self
io_threadsshadows      S/var/www/cvtools/html/venv/lib/python3.12/site-packages/zmq/backend/cffi/context.py__init__zContext.__init__   s    HHXv6DMDL DL?v&&MMODM==CHH$1;;=))MM$--Z@    c                 T    t        t        j                  d| j                              S )z,The address of the underlying libzmq contextsize_t)intr	   r   r   r   s    r   
underlyingzContext.underlying#   s     388Hdmm455r   c                     | j                   S )N)r   r    s    r   closedzContext.closed(   s    ||r   c                 \    t        j                  | j                  ||      }t        |       y)z6set a context option

        see zmq_ctx_set
        N)r   r   r   r   )r   optionvaluercs       r   setzContext.set,   s!    
 ]]4==&%8"r   c                 `    t        j                  | j                  |      }t        |d       |S )z4get context option

        see zmq_ctx_get
        F)error_without_errno)r   zmq_ctx_getr   r   )r   r%   r'   s      r   getzContext.get4   s'    
 ]]4==&1"%0	r   c                     | j                   ry t        j                  | j                        }	 t	        |       d | _        d| _        y # t
        $ r Y w xY w)NT)r#   r   zmq_ctx_destroyr   r   r   r   )r   r'   s     r   termzContext.term=   sR    ;;t}}-	bM  % 	 	s   A 	AA)r   N)__name__
__module____qualname__r   
_iothreadsr   r   r   propertyr!   r#   r(   r,   r/    r   r   r   r      sR    HJGG  6 6  r   r   N)__doc__zmq.constantsr   r   	zmq.errorr   r   r   _cffir	   r
   r   r   __all__r5   r   r   <module>r;      s-    
 - @ @  = =@ +r   