Debian Codegraph @

doc/docstrings/share_close.rst

raw
1 close() -> None
2 ----------------
3
4 Close shared handle.
5
6 Corresponds to `curl_share_cleanup`_ in libcurl. This method is
7 automatically called by pycurl when a ``CurlShare`` object no longer has
8 any references to it, but can also be called explicitly.
9
10 The behavior of ``close()`` depends on the ``detach_on_close`` setting
11 of the ``CurlShare``:
12
13 - If ``detach_on_close`` is ``True`` (default), all associated
14 :ref:`Curl objects <curlobject>` are first detached from the share
15 before the share handle is closed. Detaching clears the ``SHARE``
16 option on each ``Curl`` object but does not close them.
17
18 - If ``detach_on_close`` is ``False``, calling ``close()`` while there
19 are still associated ``Curl`` objects raises ``pycurl.error`` and the
20 share handle is not closed.
21
22 .. warning::
23
24 Automatic detachment performed when ``detach_on_close`` is ``True``
25 is **not thread-safe** with respect to the associated ``Curl``
26 objects. The caller must ensure that no other thread is operating on
27 those ``Curl`` objects while ``close()`` is executing.
28
29 .. _curl_share_cleanup:
30 https://curl.haxx.se/libcurl/c/curl_share_cleanup.html