a
    ø£Be´  ã                   @  sŽ   d dl mZ d dlZd dlm  mZ d dlm	Z	 d dl
mZ ddlmZ ddlmZ edƒZd	dd
œddddddœdd„Zddœdd„ZdS )é    )ÚannotationsN)ÚCallable)ÚTypeVaré   )Úget_async_backend)ÚCapacityLimiterÚT_RetvalF©ÚcancellableÚlimiterzCallable[..., T_Retval]ÚobjectÚboolzCapacityLimiter | None)ÚfuncÚargsr
   r   Úreturnc                Ç  s   t ƒ j| |||d�I dH S )a�  
    Call the given function with the given arguments in a worker thread.

    If the ``cancellable`` option is enabled and the task waiting for its completion is
    cancelled, the thread will still run its course but its return value (or any raised
    exception) will be ignored.

    :param func: a callable
    :param args: positional arguments for the callable
    :param cancellable: ``True`` to allow cancellation of the operation
    :param limiter: capacity limiter to use to limit the total amount of threads running
        (if omitted, the default limiter is used)
    :return: an awaitable that yields the return value of the function.

    r	   N)r   Zrun_sync_in_worker_thread)r   r
   r   r   © r   úR/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/anyio/to_thread.pyÚrun_sync   s    ÿr   r   )r   c                   C  s
   t ƒ  ¡ S )z•
    Return the capacity limiter that is used by default to limit the number of
    concurrent threads.

    :return: a capacity limiter object

    )r   Úcurrent_default_thread_limiterr   r   r   r   r   &   s    r   )Ú
__future__r   ÚbuiltinsÚ@py_builtinsÚ_pytest.assertion.rewriteÚ	assertionÚrewriteÚ
@pytest_arÚcollections.abcr   Útypingr   Ú_core._eventloopr   Úabcr   r   r   r   r   r   r   r   Ú<module>   s   &ü