chunk_id stringlengths 36 36 | source stringclasses 35
values | source_url stringlengths 0 290 | upstream_license stringclasses 1
value | document_id stringlengths 36 36 | chunk_index int64 0 324k | retrieved_at stringclasses 2
values | chunker_version stringclasses 4
values | content_hash stringlengths 15 64 | content stringlengths 50 44.7k | namespace stringclasses 9
values | source_name stringclasses 35
values | raw_text stringlengths 50 44.7k | cleaned_text stringlengths 50 44.7k | tags stringclasses 49
values | collection_name stringclasses 11
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11eedbbb-633a-4d62-9c24-0b014189df96 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,450 | supabase-export-v2 | 0a98657928a7b330 | * If the same thread owns the lock, acquire the lock again and return immediately.
In all cases, if the thread was able to acquire the lock, return ``True``. If the thread was unable to acquire the lock (i.e. if not blocking or
the timeout was reached) return ``False``. | trusted_official_docs | CPython Docs | * If the same thread owns the lock, acquire the lock again and return immediately.
In all cases, if the thread was able to acquire the lock, return ``True``. If the thread was unable to acquire the lock (i.e. if not blocking or
the timeout was reached) return ``False``. | * If the same thread owns the lock, acquire the lock again and return immediately.
In all cases, if the thread was able to acquire the lock, return ``True``. If the thread was unable to acquire the lock (i.e. if not blocking or
the timeout was reached) return ``False``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
11fd7518-de87-4727-9838-68d14b1ea03a | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,532 | supabase-export-v2 | ebc85ad6836e81ed | Once spawned, worker threads call the semaphore's acquire and release methods when they need to connect to the server::
with pool_sema:
conn = connectdb()
try:
# ... use connection ... finally:
conn.close() | trusted_official_docs | CPython Docs | Once spawned, worker threads call the semaphore's acquire and release methods when they need to connect to the server::
with pool_sema:
conn = connectdb()
try:
# ... use connection ... finally:
conn.close() | Once spawned, worker threads call the semaphore's acquire and release methods when they need to connect to the server::
with pool_sema:
conn = connectdb()
try:
# ... use connection ... finally:
conn.close() | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
13613a11-44a4-47e8-b955-7eb0ac6a70ef | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,255 | supabase-export-v2 | 8dabe9a73ab6a589 | a custom hook can create a reference cycle. It should be cleared explicitly to break the reference cycle when the exception is no longer needed.
Storing *thread* using a custom hook can resurrect it if it is set to an
object which is being finalized. Avoid storing *thread* after the custom
hook completes to avoid res... | trusted_official_docs | CPython Docs | a custom hook can create a reference cycle. It should be cleared explicitly to break the reference cycle when the exception is no longer needed.
Storing *thread* using a custom hook can resurrect it if it is set to an
object which is being finalized. Avoid storing *thread* after the custom
hook completes to avoid res... | a custom hook can create a reference cycle. It should be cleared explicitly to break the reference cycle when the exception is no longer needed.
Storing *thread* using a custom hook can resurrect it if it is set to an
object which is being finalized. Avoid storing *thread* after the custom
hook completes to avoid res... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1448b6b9-f02c-4239-855a-82d58e9c3105 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,603 | supabase-export-v2 | 52e1b9244c0ca36e | thread is running ``__next__()``, the others block until the iterator becomes available. Each value produced by the underlying iterator is delivered to exactly one caller.
The :func:`concurrent_tee` function lets multiple threads each receive the full
stream of values from one underlying iterator. It creates independen... | trusted_official_docs | CPython Docs | thread is running ``__next__()``, the others block until the iterator becomes available. Each value produced by the underlying iterator is delivered to exactly one caller.
The :func:`concurrent_tee` function lets multiple threads each receive the full
stream of values from one underlying iterator. It creates independen... | thread is running ``__next__()``, the others block until the iterator becomes available. Each value produced by the underlying iterator is delivered to exactly one caller.
The :func:`concurrent_tee` function lets multiple threads each receive the full
stream of values from one underlying iterator. It creates independen... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
15c5a59a-8c38-441b-a6fb-3505ec8f3480 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,238 | supabase-export-v2 | 33e9121cabadbbda | 3.13, :term:`free-threaded <free threading>` builds can disable the GIL, enabling true parallel execution of threads, but this feature is not available by default (see :pep:`703`).
.. TODO: At some point this feature will become available by default. | trusted_official_docs | CPython Docs | 3.13, :term:`free-threaded <free threading>` builds can disable the GIL, enabling true parallel execution of threads, but this feature is not available by default (see :pep:`703`).
.. TODO: At some point this feature will become available by default. | 3.13, :term:`free-threaded <free threading>` builds can disable the GIL, enabling true parallel execution of threads, but this feature is not available by default (see :pep:`703`).
.. TODO: At some point this feature will become available by default. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
16e0701a-51eb-44ef-8d6f-2d7aacb1b01c | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,436 | supabase-export-v2 | 699b4ffed6add742 | .. class:: RLock()
This class implements reentrant lock objects. A reentrant lock must be
released by the thread that acquired it. Once a thread has acquired a
reentrant lock, the same thread may acquire it again without blocking; the
thread must release it once for each time it has acquired it. | trusted_official_docs | CPython Docs | .. class:: RLock()
This class implements reentrant lock objects. A reentrant lock must be
released by the thread that acquired it. Once a thread has acquired a
reentrant lock, the same thread may acquire it again without blocking; the
thread must release it once for each time it has acquired it. | .. class:: RLock()
This class implements reentrant lock objects. A reentrant lock must be
released by the thread that acquired it. Once a thread has acquired a
reentrant lock, the same thread may acquire it again without blocking; the
thread must release it once for each time it has acquired it. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1812a08a-b02e-442c-8b9a-5c54467aaf95 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,608 | supabase-export-v2 | 2879fe07ebea7506 | at a time. No values are duplicated or skipped by the wrapper itself. Each item from the underlying iterator is given to exactly one caller.
This wrapper does not copy or buffer values. Threads that call
:func:`next` while another thread is already advancing the iterator will
block until the active call completes. | trusted_official_docs | CPython Docs | at a time. No values are duplicated or skipped by the wrapper itself. Each item from the underlying iterator is given to exactly one caller.
This wrapper does not copy or buffer values. Threads that call
:func:`next` while another thread is already advancing the iterator will
block until the active call completes. | at a time. No values are duplicated or skipped by the wrapper itself. Each item from the underlying iterator is given to exactly one caller.
This wrapper does not copy or buffer values. Threads that call
:func:`next` while another thread is already advancing the iterator will
block until the active call completes. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
183187db-102e-4912-ab28-430669b0476c | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,530 | supabase-export-v2 | a08f72127e5ecafb | the size of the resource is fixed, you should use a bounded semaphore. Before spawning any worker threads, your main thread would initialize the semaphore::
maxconnections = 5
# ... pool_sema = BoundedSemaphore(value=maxconnections) | trusted_official_docs | CPython Docs | the size of the resource is fixed, you should use a bounded semaphore. Before spawning any worker threads, your main thread would initialize the semaphore::
maxconnections = 5
# ... pool_sema = BoundedSemaphore(value=maxconnections) | the size of the resource is fixed, you should use a bounded semaphore. Before spawning any worker threads, your main thread would initialize the semaphore::
maxconnections = 5
# ... pool_sema = BoundedSemaphore(value=maxconnections) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
18820862-9073-4347-86ac-bd2fe55199bd | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,347 | supabase-export-v2 | 64b18b742712b31a | always considered alive and daemonic, and cannot be :ref:`joined <meth-thread-join>`. They are never deleted, since it is impossible to detect the termination of alien threads.
.. class:: Thread(group=None, target=None, name=None, args=(), kwargs={}, *, \
daemon=None, context=None) | trusted_official_docs | CPython Docs | always considered alive and daemonic, and cannot be :ref:`joined <meth-thread-join>`. They are never deleted, since it is impossible to detect the termination of alien threads.
.. class:: Thread(group=None, target=None, name=None, args=(), kwargs={}, *, \
daemon=None, context=None) | always considered alive and daemonic, and cannot be :ref:`joined <meth-thread-join>`. They are never deleted, since it is impossible to detect the termination of alien threads.
.. class:: Thread(group=None, target=None, name=None, args=(), kwargs={}, *, \
daemon=None, context=None) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
199c72f6-ef03-49c7-aeed-ada02072d300 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,549 | supabase-export-v2 | 45505cf97620c8ba | flag is set to true, or ``False`` if a timeout is given and the internal flag did not become true within the given wait time.
When the timeout argument is present and not ``None``, it should be a
real number specifying a timeout for the operation in seconds,
or fractions thereof. | trusted_official_docs | CPython Docs | flag is set to true, or ``False`` if a timeout is given and the internal flag did not become true within the given wait time.
When the timeout argument is present and not ``None``, it should be a
real number specifying a timeout for the operation in seconds,
or fractions thereof. | flag is set to true, or ``False`` if a timeout is given and the internal flag did not become true within the given wait time.
When the timeout argument is present and not ``None``, it should be a
real number specifying a timeout for the operation in seconds,
or fractions thereof. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
19a0fcb6-1a6b-4399-b96e-0c57bbe8fc76 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,374 | supabase-export-v2 | 3c57d617a1dffb61 | thread until the thread whose :meth:`~Thread.join` method is called terminates -- either normally or through an unhandled exception -- or until the optional timeout occurs.
When the *timeout* argument is present and not ``None``, it should be a
real number specifying a timeout for the operation in seconds
(or fractio... | trusted_official_docs | CPython Docs | thread until the thread whose :meth:`~Thread.join` method is called terminates -- either normally or through an unhandled exception -- or until the optional timeout occurs.
When the *timeout* argument is present and not ``None``, it should be a
real number specifying a timeout for the operation in seconds
(or fractio... | thread until the thread whose :meth:`~Thread.join` method is called terminates -- either normally or through an unhandled exception -- or until the optional timeout occurs.
When the *timeout* argument is present and not ``None``, it should be a
real number specifying a timeout for the operation in seconds
(or fractio... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
19c85a82-be95-4e1f-810a-302da5b69c1c | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,316 | supabase-export-v2 | e0f34e7d22c484c0 | was read. For that reason, you generally don't want to save these values across threads, as they apply only to the thread they came from.
You can create custom :class:`local` objects by subclassing the
:class:`local` class:: | trusted_official_docs | CPython Docs | was read. For that reason, you generally don't want to save these values across threads, as they apply only to the thread they came from.
You can create custom :class:`local` objects by subclassing the
:class:`local` class:: | was read. For that reason, you generally don't want to save these values across threads, as they apply only to the thread they came from.
You can create custom :class:`local` objects by subclassing the
:class:`local` class:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1a0dfa11-e156-4c3d-a1fb-a3eee2a2855c | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,219 | supabase-export-v2 | c73b9737ab99ad18 | useful when tasks are I/O bound, such as file operations or making network requests, where much of the time is spent waiting for external resources.
A typical use case for :mod:`!threading` includes managing a pool of worker
threads that can process multiple tasks concurrently. Here's a basic example of
creating and st... | trusted_official_docs | CPython Docs | useful when tasks are I/O bound, such as file operations or making network requests, where much of the time is spent waiting for external resources.
A typical use case for :mod:`!threading` includes managing a pool of worker
threads that can process multiple tasks concurrently. Here's a basic example of
creating and st... | useful when tasks are I/O bound, such as file operations or making network requests, where much of the time is spent waiting for external resources.
A typical use case for :mod:`!threading` includes managing a pool of worker
threads that can process multiple tasks concurrently. Here's a basic example of
creating and st... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1b66895d-2b79-4b1d-ab37-3006cb18bb65 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,508 | supabase-export-v2 | b92ae0ce3098d8ed | :meth:`~Semaphore.release` call. The counter can never go below zero; when :meth:`~Semaphore.acquire` finds that it is zero, it blocks, waiting until some other thread calls :meth:`~Semaphore.release`.
Semaphores also support the :ref:`context management protocol <with-locks>`. | trusted_official_docs | CPython Docs | :meth:`~Semaphore.release` call. The counter can never go below zero; when :meth:`~Semaphore.acquire` finds that it is zero, it blocks, waiting until some other thread calls :meth:`~Semaphore.release`.
Semaphores also support the :ref:`context management protocol <with-locks>`. | :meth:`~Semaphore.release` call. The counter can never go below zero; when :meth:`~Semaphore.acquire` finds that it is zero, it blocks, waiting until some other thread calls :meth:`~Semaphore.release`.
Semaphores also support the :ref:`context management protocol <with-locks>`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1c791a16-0963-44f7-a214-be8b6d6c6edc | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,407 | supabase-export-v2 | 03a16358adac4527 | Locks also support the :ref:`context management protocol <with-locks>`.
When more than one thread is blocked in :meth:`~Lock.acquire` waiting for the
state to turn to unlocked, only one thread proceeds when a :meth:`~Lock.release`
call resets the state to unlocked; which one of the waiting threads proceeds
is not defin... | trusted_official_docs | CPython Docs | Locks also support the :ref:`context management protocol <with-locks>`.
When more than one thread is blocked in :meth:`~Lock.acquire` waiting for the
state to turn to unlocked, only one thread proceeds when a :meth:`~Lock.release`
call resets the state to unlocked; which one of the waiting threads proceeds
is not defin... | Locks also support the :ref:`context management protocol <with-locks>`.
When more than one thread is blocked in :meth:`~Lock.acquire` waiting for the
state to turn to unlocked, only one thread proceeds when a :meth:`~Lock.release`
call resets the state to unlocked; which one of the waiting threads proceeds
is not defin... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1d2c97d1-097c-4500-b015-b7c30667b0af | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,384 | supabase-export-v2 | e6648f6aac044a3c | used for identification purposes only. It has no semantics. Multiple threads may be given the same name. The initial name is set by the constructor.
On some platforms, the thread name is set at the operating system level
when the thread starts, so that it is visible in task managers. This name may be truncated to fit ... | trusted_official_docs | CPython Docs | used for identification purposes only. It has no semantics. Multiple threads may be given the same name. The initial name is set by the constructor.
On some platforms, the thread name is set at the operating system level
when the thread starts, so that it is visible in task managers. This name may be truncated to fit ... | used for identification purposes only. It has no semantics. Multiple threads may be given the same name. The initial name is set by the constructor.
On some platforms, the thread name is set at the operating system level
when the thread starts, so that it is visible in task managers. This name may be truncated to fit ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1d74f39a-abd7-406a-9196-82ec96071353 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,462 | supabase-export-v2 | 4578a22e98d0686c | useful when several condition variables must share the same lock. The lock is part of the condition object: you don't have to track it separately.
A condition variable obeys the :ref:`context management protocol <with-locks>`:
using the ``with`` statement acquires the associated lock for the duration of
the enclosed bl... | trusted_official_docs | CPython Docs | useful when several condition variables must share the same lock. The lock is part of the condition object: you don't have to track it separately.
A condition variable obeys the :ref:`context management protocol <with-locks>`:
using the ``with`` statement acquires the associated lock for the duration of
the enclosed bl... | useful when several condition variables must share the same lock. The lock is part of the condition object: you don't have to track it separately.
A condition variable obeys the :ref:`context management protocol <with-locks>`:
using the ``with`` statement acquires the associated lock for the duration of
the enclosed bl... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1d7b5f71-bf63-415c-9819-76dc26b5bd9f | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,502 | supabase-export-v2 | b42277829387a2aa | .. method:: notify_all()
Wake up all threads waiting on this condition. This method acts like
:meth:`notify`, but wakes up all waiting threads instead of one. If the
calling thread has not acquired the lock when this method is called, a
:exc:`RuntimeError` is raised. | trusted_official_docs | CPython Docs | .. method:: notify_all()
Wake up all threads waiting on this condition. This method acts like
:meth:`notify`, but wakes up all waiting threads instead of one. If the
calling thread has not acquired the lock when this method is called, a
:exc:`RuntimeError` is raised. | .. method:: notify_all()
Wake up all threads waiting on this condition. This method acts like
:meth:`notify`, but wakes up all waiting threads instead of one. If the
calling thread has not acquired the lock when this method is called, a
:exc:`RuntimeError` is raised. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
21932b09-229e-4364-8b10-98cc05073872 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,364 | supabase-export-v2 | bb9848db67a991be | If supported, set the operating system thread name to :attr:`threading.Thread.name`. The name can be truncated depending on the operating system thread name limits.
.. versionchanged:: 3.14
Set the operating system thread name. | trusted_official_docs | CPython Docs | If supported, set the operating system thread name to :attr:`threading.Thread.name`. The name can be truncated depending on the operating system thread name limits.
.. versionchanged:: 3.14
Set the operating system thread name. | If supported, set the operating system thread name to :attr:`threading.Thread.name`. The name can be truncated depending on the operating system thread name limits.
.. versionchanged:: 3.14
Set the operating system thread name. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
24a5f0fb-ecf2-439c-9a7b-624982c0186a | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,357 | supabase-export-v2 | 5c4ae0b8e2d5c264 | If the subclass overrides the constructor, it must make sure to invoke the base class constructor (``Thread.__init__()``) before doing anything else to the thread.
.. versionchanged:: 3.3
Added the *daemon* parameter. | trusted_official_docs | CPython Docs | If the subclass overrides the constructor, it must make sure to invoke the base class constructor (``Thread.__init__()``) before doing anything else to the thread.
.. versionchanged:: 3.3
Added the *daemon* parameter. | If the subclass overrides the constructor, it must make sure to invoke the base class constructor (``Thread.__init__()``) before doing anything else to the thread.
.. versionchanged:: 3.3
Added the *daemon* parameter. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
24f40688-f681-4637-8bf9-1304ab48712b | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,263 | supabase-export-v2 | 0af459dda838158a | .. function:: get_native_id()
Return the native integral Thread ID of the current thread assigned by the kernel. This is a non-negative integer. Its value may be used to uniquely identify this particular thread system-wide
(until the thread terminates, after which the value may be recycled by the OS). | trusted_official_docs | CPython Docs | .. function:: get_native_id()
Return the native integral Thread ID of the current thread assigned by the kernel. This is a non-negative integer. Its value may be used to uniquely identify this particular thread system-wide
(until the thread terminates, after which the value may be recycled by the OS). | .. function:: get_native_id()
Return the native integral Thread ID of the current thread assigned by the kernel. This is a non-negative integer. Its value may be used to uniquely identify this particular thread system-wide
(until the thread terminates, after which the value may be recycled by the OS). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
26036945-e156-49f7-9561-cca538653482 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,224 | supabase-export-v2 | 6aedad3a67ddfa1b | = [] for link in links: # Using `args` to pass positional arguments and `kwargs` for keyword arguments t = threading.Thread(target=crawl, args=(link,), kwargs={"delay": 2}) threads.append(t)
# Start each thread
for t in threads:
t.start() | trusted_official_docs | CPython Docs | = [] for link in links: # Using `args` to pass positional arguments and `kwargs` for keyword arguments t = threading.Thread(target=crawl, args=(link,), kwargs={"delay": 2}) threads.append(t)
# Start each thread
for t in threads:
t.start() | = [] for link in links: # Using `args` to pass positional arguments and `kwargs` for keyword arguments t = threading.Thread(target=crawl, args=(link,), kwargs={"delay": 2}) threads.append(t)
# Start each thread
for t in threads:
t.start() | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
26e68f69-4535-40e9-9ea8-6f4e64901835 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,341 | supabase-export-v2 | 03200ff6095b6184 | Other threads can call a thread's :meth:`~Thread.join` method. This blocks the calling thread until the thread whose :meth:`~Thread.join` method is called is terminated.
A thread has a name. The name can be passed to the constructor, and read or
changed through the :attr:`~Thread.name` attribute. | trusted_official_docs | CPython Docs | Other threads can call a thread's :meth:`~Thread.join` method. This blocks the calling thread until the thread whose :meth:`~Thread.join` method is called is terminated.
A thread has a name. The name can be passed to the constructor, and read or
changed through the :attr:`~Thread.name` attribute. | Other threads can call a thread's :meth:`~Thread.join` method. This blocks the calling thread until the thread whose :meth:`~Thread.join` method is called is terminated.
A thread has a name. The name can be passed to the constructor, and read or
changed through the :attr:`~Thread.name` attribute. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
28440125-4528-49be-be14-a936c918d10a | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,246 | supabase-export-v2 | badd60bb9bc21d94 | thread of control. If the caller's thread of control was not created through the :mod:`!threading` module, a dummy thread object with limited functionality is returned.
The function ``currentThread`` is a deprecated alias for this function. | trusted_official_docs | CPython Docs | thread of control. If the caller's thread of control was not created through the :mod:`!threading` module, a dummy thread object with limited functionality is returned.
The function ``currentThread`` is a deprecated alias for this function. | thread of control. If the caller's thread of control was not created through the :mod:`!threading` module, a dummy thread object with limited functionality is returned.
The function ``currentThread`` is a deprecated alias for this function. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
28676455-1e0f-43bf-9fcd-caf175883973 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,492 | supabase-export-v2 | b796d16ee1482ca9 | *predicate* should be a callable which result will be interpreted as a boolean value. A *timeout* may be provided giving the maximum time to wait.
This utility method may call :meth:`wait` repeatedly until the predicate
is satisfied, or until a timeout occurs. The return value is
the last return value of the predicat... | trusted_official_docs | CPython Docs | *predicate* should be a callable which result will be interpreted as a boolean value. A *timeout* may be provided giving the maximum time to wait.
This utility method may call :meth:`wait` repeatedly until the predicate
is satisfied, or until a timeout occurs. The return value is
the last return value of the predicat... | *predicate* should be a callable which result will be interpreted as a boolean value. A *timeout* may be provided giving the maximum time to wait.
This utility method may call :meth:`wait` repeatedly until the predicate
is satisfied, or until a timeout occurs. The return value is
the last return value of the predicat... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
28b11845-0281-4403-900d-0a3820af8a21 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,229 | supabase-export-v2 | dc2564a4dd7e2b2e | interface to push tasks to a background thread without blocking execution of the calling thread, while still being able to retrieve their results when needed.
:mod:`queue` provides a thread-safe interface for exchanging data between
running threads. | trusted_official_docs | CPython Docs | interface to push tasks to a background thread without blocking execution of the calling thread, while still being able to retrieve their results when needed.
:mod:`queue` provides a thread-safe interface for exchanging data between
running threads. | interface to push tasks to a background thread without blocking execution of the calling thread, while still being able to retrieve their results when needed.
:mod:`queue` provides a thread-safe interface for exchanging data between
running threads. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
293bf180-e212-47d2-94d3-631bb55f14e8 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,602 | supabase-export-v2 | 977babf95a86f7de | called while the generator is already executing. The tools in this section allow reliable concurrency support to be added to ordinary iterators and iterator-producing callables.
The :class:`serialize_iterator` wrapper lets multiple threads share a single iterator and
take turns consuming from it. While one thread is ru... | trusted_official_docs | CPython Docs | called while the generator is already executing. The tools in this section allow reliable concurrency support to be added to ordinary iterators and iterator-producing callables.
The :class:`serialize_iterator` wrapper lets multiple threads share a single iterator and
take turns consuming from it. While one thread is ru... | called while the generator is already executing. The tools in this section allow reliable concurrency support to be added to ordinary iterators and iterator-producing callables.
The :class:`serialize_iterator` wrapper lets multiple threads share a single iterator and
take turns consuming from it. While one thread is ru... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
29794114-6dca-4c2b-b58f-8bd4f7bbee06 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,488 | supabase-export-v2 | e4886229a9f2b2fe | even when it has been recursively acquired several times. Another internal interface is then used to restore the recursion level when the lock is reacquired.
The return value is ``True`` unless a given *timeout* expired, in which
case it is ``False``. | trusted_official_docs | CPython Docs | even when it has been recursively acquired several times. Another internal interface is then used to restore the recursion level when the lock is reacquired.
The return value is ``True`` unless a given *timeout* expired, in which
case it is ``False``. | even when it has been recursively acquired several times. Another internal interface is then used to restore the recursion level when the lock is reacquired.
The return value is ``True`` unless a given *timeout* expired, in which
case it is ``False``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2b19c324-a5e2-475f-a9b0-8271dc3e886f | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,250 | supabase-export-v2 | 945026eed7e9ebdc | The *args* argument has the following attributes:
* *exc_type*: Exception type. * *exc_value*: Exception value, can be ``None``. * *exc_traceback*: Exception traceback, can be ``None``. * *thread*: Thread which raised the exception, can be ``None``. | trusted_official_docs | CPython Docs | The *args* argument has the following attributes:
* *exc_type*: Exception type. * *exc_value*: Exception value, can be ``None``. * *exc_traceback*: Exception traceback, can be ``None``. * *thread*: Thread which raised the exception, can be ``None``. | The *args* argument has the following attributes:
* *exc_type*: Exception type. * *exc_value*: Exception value, can be ``None``. * *exc_traceback*: Exception traceback, can be ``None``. * *thread*: Thread which raised the exception, can be ``None``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2b358b2e-3663-4a80-b527-71de5920fcbf | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,526 | supabase-export-v2 | d5c7fd05fa7f6d77 | resources with limited capacity. If the semaphore is released too many times it's a sign of a bug. If not given, *value* defaults to 1.
.. versionchanged:: 3.3
changed from a factory function to a class. | trusted_official_docs | CPython Docs | resources with limited capacity. If the semaphore is released too many times it's a sign of a bug. If not given, *value* defaults to 1.
.. versionchanged:: 3.3
changed from a factory function to a class. | resources with limited capacity. If the semaphore is released too many times it's a sign of a bug. If not given, *value* defaults to 1.
.. versionchanged:: 3.3
changed from a factory function to a class. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2b55d306-9d57-46d2-8b66-692a182cab61 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,467 | supabase-export-v2 | 84247a1eb8f9d20a | could possibly be a desired state for one of the waiters. For example, the following code is a generic producer-consumer situation with unlimited buffer capacity::
# Consume one item
with cv:
while not an_item_is_available():
cv.wait()
get_an_available_item() | trusted_official_docs | CPython Docs | could possibly be a desired state for one of the waiters. For example, the following code is a generic producer-consumer situation with unlimited buffer capacity::
# Consume one item
with cv:
while not an_item_is_available():
cv.wait()
get_an_available_item() | could possibly be a desired state for one of the waiters. For example, the following code is a generic producer-consumer situation with unlimited buffer capacity::
# Consume one item
with cv:
while not an_item_is_available():
cv.wait()
get_an_available_item() | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2bad2ef2-9058-4376-908d-680e373a9b8e | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,389 | supabase-export-v2 | 87866d4a882701fe | .. attribute:: ident
The 'thread identifier' of this thread or ``None`` if the thread has not
been started. This is a nonzero integer. See the :func:`get_ident`
function. Thread identifiers may be recycled when a thread exits and
another thread is created. The identifier is available even after the
thread has exite... | trusted_official_docs | CPython Docs | .. attribute:: ident
The 'thread identifier' of this thread or ``None`` if the thread has not
been started. This is a nonzero integer. See the :func:`get_ident`
function. Thread identifiers may be recycled when a thread exits and
another thread is created. The identifier is available even after the
thread has exite... | .. attribute:: ident
The 'thread identifier' of this thread or ``None`` if the thread has not
been started. This is a nonzero integer. See the :func:`get_ident`
function. Thread identifiers may be recycled when a thread exits and
another thread is created. The identifier is available even after the
thread has exite... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2dc53baf-db14-47ea-803a-8564165dfc6e | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,399 | supabase-export-v2 | eb45998cb41086d5 | .. attribute:: daemon
A boolean value indicating whether this thread is a daemon thread (``True``)
or not (``False``). This must be set before :meth:`~Thread.start` is called,
otherwise :exc:`RuntimeError` is raised. Its initial value is inherited
from the creating thread; the main thread is not a daemon thread and
... | trusted_official_docs | CPython Docs | .. attribute:: daemon
A boolean value indicating whether this thread is a daemon thread (``True``)
or not (``False``). This must be set before :meth:`~Thread.start` is called,
otherwise :exc:`RuntimeError` is raised. Its initial value is inherited
from the creating thread; the main thread is not a daemon thread and
... | .. attribute:: daemon
A boolean value indicating whether this thread is a daemon thread (``True``)
or not (``False``). This must be set before :meth:`~Thread.start` is called,
otherwise :exc:`RuntimeError` is raised. Its initial value is inherited
from the creating thread; the main thread is not a daemon thread and
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2e2ff53e-d6a3-4d29-ba2d-8f295d47c80d | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,269 | supabase-export-v2 | eb0692f0824a011a | .. function:: enumerate()
Return a list of all :class:`Thread` objects currently active. The list
includes daemonic threads and dummy thread objects created by
:func:`current_thread`. It excludes terminated threads and threads
that have not yet been started. However, the main thread is always part
of the result, ev... | trusted_official_docs | CPython Docs | .. function:: enumerate()
Return a list of all :class:`Thread` objects currently active. The list
includes daemonic threads and dummy thread objects created by
:func:`current_thread`. It excludes terminated threads and threads
that have not yet been started. However, the main thread is always part
of the result, ev... | .. function:: enumerate()
Return a list of all :class:`Thread` objects currently active. The list
includes daemonic threads and dummy thread objects created by
:func:`current_thread`. It excludes terminated threads and threads
that have not yet been started. However, the main thread is always part
of the result, ev... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2e607204-8ba4-4536-ab84-8346d0b8a617 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,429 | supabase-export-v2 | eba671019455cb93 | RLock objects ^^^^^^^^^^^^^
A reentrant lock is a synchronization primitive that may be acquired multiple
times by the same thread. Internally, it uses the concepts of "owning thread"
and "recursion level" in addition to the locked/unlocked state used by primitive
locks. In the locked state, some thread owns the lock; ... | trusted_official_docs | CPython Docs | RLock objects ^^^^^^^^^^^^^
A reentrant lock is a synchronization primitive that may be acquired multiple
times by the same thread. Internally, it uses the concepts of "owning thread"
and "recursion level" in addition to the locked/unlocked state used by primitive
locks. In the locked state, some thread owns the lock; ... | RLock objects ^^^^^^^^^^^^^
A reentrant lock is a synchronization primitive that may be acquired multiple
times by the same thread. Internally, it uses the concepts of "owning thread"
and "recursion level" in addition to the locked/unlocked state used by primitive
locks. In the locked state, some thread owns the lock; ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2ef7ecef-a919-432c-abb2-2a06fad015a2 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,519 | supabase-export-v2 | 17247649b01f15b3 | other than ``None``, it will block for at most *timeout* seconds. If acquire does not complete successfully in that interval, return ``False``. Return ``True`` otherwise.
.. versionchanged:: 3.2
The *timeout* parameter is new. | trusted_official_docs | CPython Docs | other than ``None``, it will block for at most *timeout* seconds. If acquire does not complete successfully in that interval, return ``False``. Return ``True`` otherwise.
.. versionchanged:: 3.2
The *timeout* parameter is new. | other than ``None``, it will block for at most *timeout* seconds. If acquire does not complete successfully in that interval, return ``False``. Return ``True`` otherwise.
.. versionchanged:: 3.2
The *timeout* parameter is new. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
320506e3-f08c-4b22-9b2c-c6b3d094872e | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,487 | supabase-export-v2 | 27dd4407a550417e | the *timeout* argument is present and not ``None``, it should be a real number specifying a timeout for the operation in seconds (or fractions thereof).
When the underlying lock is an :class:`RLock`, it is not released using
its :meth:`release` method, since this may not actually unlock the lock
when it was acquired ... | trusted_official_docs | CPython Docs | the *timeout* argument is present and not ``None``, it should be a real number specifying a timeout for the operation in seconds (or fractions thereof).
When the underlying lock is an :class:`RLock`, it is not released using
its :meth:`release` method, since this may not actually unlock the lock
when it was acquired ... | the *timeout* argument is present and not ``None``, it should be a real number specifying a timeout for the operation in seconds (or fractions thereof).
When the underlying lock is an :class:`RLock`, it is not released using
its :meth:`release` method, since this may not actually unlock the lock
when it was acquired ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
35bc1c08-e26c-46de-b28d-86c45d9671f5 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,506 | supabase-export-v2 | 135fdbe82aafbf5d | Semaphore objects ^^^^^^^^^^^^^^^^^
This is one of the oldest synchronization primitives in the history of computer
science, invented by the early Dutch computer scientist Edsger W. Dijkstra (he
used the names ``P()`` and ``V()`` instead of :meth:`~Semaphore.acquire` and
:meth:`~Semaphore.release`). | trusted_official_docs | CPython Docs | Semaphore objects ^^^^^^^^^^^^^^^^^
This is one of the oldest synchronization primitives in the history of computer
science, invented by the early Dutch computer scientist Edsger W. Dijkstra (he
used the names ``P()`` and ``V()`` instead of :meth:`~Semaphore.acquire` and
:meth:`~Semaphore.release`). | Semaphore objects ^^^^^^^^^^^^^^^^^
This is one of the oldest synchronization primitives in the history of computer
science, invented by the early Dutch computer scientist Edsger W. Dijkstra (he
used the names ``P()`` and ``V()`` instead of :meth:`~Semaphore.acquire` and
:meth:`~Semaphore.release`). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3715aa97-9e31-4563-a0ba-f72aede48051 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,338 | supabase-export-v2 | d81e6b40f276074a | other methods (except for the constructor) should be overridden in a subclass. In other words, *only* override the ``__init__()`` and :meth:`~Thread.run` methods of this class.
Once a thread object is created, its activity must be started by calling the
thread's :meth:`~Thread.start` method. This invokes the :meth:`~Th... | trusted_official_docs | CPython Docs | other methods (except for the constructor) should be overridden in a subclass. In other words, *only* override the ``__init__()`` and :meth:`~Thread.run` methods of this class.
Once a thread object is created, its activity must be started by calling the
thread's :meth:`~Thread.start` method. This invokes the :meth:`~Th... | other methods (except for the constructor) should be overridden in a subclass. In other words, *only* override the ``__init__()`` and :meth:`~Thread.run` methods of this class.
Once a thread object is created, its activity must be started by calling the
thread's :meth:`~Thread.start` method. This invokes the :meth:`~Th... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3a8bdce7-7f37-4129-8324-37c1cdd691cc | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,223 | supabase-export-v2 | 401140b0c1726230 | links = [ "https://python.org", "https://docs.python.org", "https://peps.python.org", ]
# Start threads for each link
threads = []
for link in links:
# Using `args` to pass positional arguments and `kwargs` for keyword arguments
t = threading.Thread(target=crawl, args=(link,), kwargs={"delay": 2})
threads.append(t... | trusted_official_docs | CPython Docs | links = [ "https://python.org", "https://docs.python.org", "https://peps.python.org", ]
# Start threads for each link
threads = []
for link in links:
# Using `args` to pass positional arguments and `kwargs` for keyword arguments
t = threading.Thread(target=crawl, args=(link,), kwargs={"delay": 2})
threads.append(t... | links = [ "https://python.org", "https://docs.python.org", "https://peps.python.org", ]
# Start threads for each link
threads = []
for link in links:
# Using `args` to pass positional arguments and `kwargs` for keyword arguments
t = threading.Thread(target=crawl, args=(link,), kwargs={"delay": 2})
threads.append(t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3bc3d031-0743-4882-a0d5-fe4da7c32fc5 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,576 | supabase-export-v2 | ad9b23f5deac0388 | i = barrier.wait() if i == 0: # Only one thread needs to print this print("passed the barrier")
If an *action* was provided to the constructor, one of the threads will
have called it prior to being released. Should this call raise an error,
the barrier is put into the broken state. | trusted_official_docs | CPython Docs | i = barrier.wait() if i == 0: # Only one thread needs to print this print("passed the barrier")
If an *action* was provided to the constructor, one of the threads will
have called it prior to being released. Should this call raise an error,
the barrier is put into the broken state. | i = barrier.wait() if i == 0: # Only one thread needs to print this print("passed the barrier")
If an *action* was provided to the constructor, one of the threads will
have called it prior to being released. Should this call raise an error,
the barrier is put into the broken state. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3c7ff017-1958-4d2a-b6cf-23bfe5c6a08f | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,377 | supabase-export-v2 | 32fec299d9db6cbd | A thread can be joined many times.
:meth:`~Thread.join` raises a :exc:`RuntimeError` if an attempt is made
to join the current thread as that would cause a deadlock. It is also
an error to :meth:`~Thread.join` a thread before it has been started
and attempts to do so raise the same exception. | trusted_official_docs | CPython Docs | A thread can be joined many times.
:meth:`~Thread.join` raises a :exc:`RuntimeError` if an attempt is made
to join the current thread as that would cause a deadlock. It is also
an error to :meth:`~Thread.join` a thread before it has been started
and attempts to do so raise the same exception. | A thread can be joined many times.
:meth:`~Thread.join` raises a :exc:`RuntimeError` if an attempt is made
to join the current thread as that would cause a deadlock. It is also
an error to :meth:`~Thread.join` a thread before it has been started
and attempts to do so raise the same exception. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3edab50d-889d-4a4f-9fb3-e8438d726cac | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,495 | supabase-export-v2 | 52f9ee17e12c0a50 | while not predicate(): cv.wait()
Therefore, the same rules apply as with :meth:`wait`: The lock must be
held when called and is re-acquired on return. The predicate is evaluated
with the lock held. | trusted_official_docs | CPython Docs | while not predicate(): cv.wait()
Therefore, the same rules apply as with :meth:`wait`: The lock must be
held when called and is re-acquired on return. The predicate is evaluated
with the lock held. | while not predicate(): cv.wait()
Therefore, the same rules apply as with :meth:`wait`: The lock must be
held when called and is re-acquired on return. The predicate is evaluated
with the lock held. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3f1cd137-d2b7-4337-9854-bfb34512a765 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,275 | supabase-export-v2 | bc9e2643a95fd82d | .. index:: single: trace function
Set a trace function for all threads started from the :mod:`!threading` module. The *func* will be passed to :func:`sys.settrace` for each thread, before its
:meth:`~Thread.run` method is called. | trusted_official_docs | CPython Docs | .. index:: single: trace function
Set a trace function for all threads started from the :mod:`!threading` module. The *func* will be passed to :func:`sys.settrace` for each thread, before its
:meth:`~Thread.run` method is called. | .. index:: single: trace function
Set a trace function for all threads started from the :mod:`!threading` module. The *func* will be passed to :func:`sys.settrace` for each thread, before its
:meth:`~Thread.run` method is called. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
43b18fb7-c1c7-40d4-ba77-31d2c72a3e1d | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,411 | supabase-export-v2 | 0782adaa67b21607 | primitive lock objects. Once a thread has acquired a lock, subsequent attempts to acquire it block, until it is released; any thread may release it.
.. versionchanged:: 3.13
``Lock`` is now a class. In earlier Pythons, ``Lock`` was a factory
function which returned an instance of the underlying private lock
type. | trusted_official_docs | CPython Docs | primitive lock objects. Once a thread has acquired a lock, subsequent attempts to acquire it block, until it is released; any thread may release it.
.. versionchanged:: 3.13
``Lock`` is now a class. In earlier Pythons, ``Lock`` was a factory
function which returned an instance of the underlying private lock
type. | primitive lock objects. Once a thread has acquired a lock, subsequent attempts to acquire it block, until it is released; any thread may release it.
.. versionchanged:: 3.13
``Lock`` is now a class. In earlier Pythons, ``Lock`` was a factory
function which returned an instance of the underlying private lock
type. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
453240d8-22c2-4d53-9f6d-b6bd7879b006 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,235 | supabase-export-v2 | 66256ea83c27275b | machines, you are advised to use :mod:`multiprocessing` or :class:`concurrent.futures.ProcessPoolExecutor`. However, threading is still an appropriate model if you want to run multiple I/O-bound tasks simultaneously.
GIL and performance considerations
---------------------------------- | trusted_official_docs | CPython Docs | machines, you are advised to use :mod:`multiprocessing` or :class:`concurrent.futures.ProcessPoolExecutor`. However, threading is still an appropriate model if you want to run multiple I/O-bound tasks simultaneously.
GIL and performance considerations
---------------------------------- | machines, you are advised to use :mod:`multiprocessing` or :class:`concurrent.futures.ProcessPoolExecutor`. However, threading is still an appropriate model if you want to run multiple I/O-bound tasks simultaneously.
GIL and performance considerations
---------------------------------- | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
460f34f8-9a89-4d0f-8162-5b0d014fdf1b | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,363 | supabase-export-v2 | 416bdeb432ef68b1 | This method will raise a :exc:`RuntimeError` if called more than once on the same thread object.
If supported, set the operating system thread name to
:attr:`threading.Thread.name`. The name can be truncated depending on the
operating system thread name limits. | trusted_official_docs | CPython Docs | This method will raise a :exc:`RuntimeError` if called more than once on the same thread object.
If supported, set the operating system thread name to
:attr:`threading.Thread.name`. The name can be truncated depending on the
operating system thread name limits. | This method will raise a :exc:`RuntimeError` if called more than once on the same thread object.
If supported, set the operating system thread name to
:attr:`threading.Thread.name`. The name can be truncated depending on the
operating system thread name limits. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4625983d-fa80-4245-b261-b706a9c65b2f | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,558 | supabase-export-v2 | a60b16b2659aac60 | .. class:: Timer(interval, function, args=None, kwargs=None)
Create a timer that will run *function* with arguments *args* and keyword
arguments *kwargs*, after *interval* seconds have passed. If *args* is ``None`` (the default) then an empty list will be used. If *kwargs* is ``None`` (the default) then an empty dict ... | trusted_official_docs | CPython Docs | .. class:: Timer(interval, function, args=None, kwargs=None)
Create a timer that will run *function* with arguments *args* and keyword
arguments *kwargs*, after *interval* seconds have passed. If *args* is ``None`` (the default) then an empty list will be used. If *kwargs* is ``None`` (the default) then an empty dict ... | .. class:: Timer(interval, function, args=None, kwargs=None)
Create a timer that will run *function* with arguments *args* and keyword
arguments *kwargs*, after *interval* seconds have passed. If *args* is ``None`` (the default) then an empty list will be used. If *kwargs* is ``None`` (the default) then an empty dict ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
46a8b1de-b6b2-4fc2-b012-45d1a57816fa | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,584 | supabase-export-v2 | 62a4862393fbd8ff | calls to :meth:`wait` to fail with the :class:`BrokenBarrierError`. Use this for example if one of the threads needs to abort, to avoid deadlocking the application.
It may be preferable to simply create the barrier with a sensible
*timeout* value to automatically guard against one of the threads going
awry. | trusted_official_docs | CPython Docs | calls to :meth:`wait` to fail with the :class:`BrokenBarrierError`. Use this for example if one of the threads needs to abort, to avoid deadlocking the application.
It may be preferable to simply create the barrier with a sensible
*timeout* value to automatically guard against one of the threads going
awry. | calls to :meth:`wait` to fail with the :class:`BrokenBarrierError`. Use this for example if one of the threads needs to abort, to avoid deadlocking the application.
It may be preferable to simply create the barrier with a sensible
*timeout* value to automatically guard against one of the threads going
awry. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
481310cf-ff7d-49d0-b75b-2d136b3a061e | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,278 | supabase-export-v2 | dc83e6c4026cc3a8 | Set a trace function for all threads started from the :mod:`!threading` module and all Python threads that are currently executing.
The *func* will be passed to :func:`sys.settrace` for each thread, before its
:meth:`~Thread.run` method is called. | trusted_official_docs | CPython Docs | Set a trace function for all threads started from the :mod:`!threading` module and all Python threads that are currently executing.
The *func* will be passed to :func:`sys.settrace` for each thread, before its
:meth:`~Thread.run` method is called. | Set a trace function for all threads started from the :mod:`!threading` module and all Python threads that are currently executing.
The *func* will be passed to :func:`sys.settrace` for each thread, before its
:meth:`~Thread.run` method is called. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4b2fe436-96a7-4c1d-a494-f7280728c67f | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,471 | supabase-export-v2 | c1a85016288609c1 | # Consume an item with cv: cv.wait_for(an_item_is_available) get_an_available_item()
To choose between :meth:`~Condition.notify` and :meth:`~Condition.notify_all`,
consider whether one state change can be interesting for only one or several
waiting threads. E.g. in a typical producer-consumer situation, adding one
item... | trusted_official_docs | CPython Docs | # Consume an item with cv: cv.wait_for(an_item_is_available) get_an_available_item()
To choose between :meth:`~Condition.notify` and :meth:`~Condition.notify_all`,
consider whether one state change can be interesting for only one or several
waiting threads. E.g. in a typical producer-consumer situation, adding one
item... | # Consume an item with cv: cv.wait_for(an_item_is_available) get_an_available_item()
To choose between :meth:`~Condition.notify` and :meth:`~Condition.notify_all`,
consider whether one state change can be interesting for only one or several
waiting threads. E.g. in a typical producer-consumer situation, adding one
item... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4bdbfbfa-b41d-4a32-864d-8992bac389c3 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,446 | supabase-export-v2 | d57bda662b296437 | immediately. This is the difference between :class:`Lock` and :class:`!RLock`; :class:`Lock` handles this case the same as the previous, blocking until the lock can be acquired.
When invoked with the *blocking* argument set to ``False``: | trusted_official_docs | CPython Docs | immediately. This is the difference between :class:`Lock` and :class:`!RLock`; :class:`Lock` handles this case the same as the previous, blocking until the lock can be acquired.
When invoked with the *blocking* argument set to ``False``: | immediately. This is the difference between :class:`Lock` and :class:`!RLock`; :class:`Lock` handles this case the same as the previous, blocking until the lock can be acquired.
When invoked with the *blocking* argument set to ``False``: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4dc1c072-c376-4cad-a93e-687a73d41678 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,464 | supabase-export-v2 | a252cc3fa9a265c1 | another thread awakens it by calling :meth:`~Condition.notify` or :meth:`~Condition.notify_all`. Once awakened, :meth:`~Condition.wait` re-acquires the lock and returns. It is also possible to specify a timeout.
The :meth:`~Condition.notify` method wakes up one of the threads waiting for
the condition variable, if any ... | trusted_official_docs | CPython Docs | another thread awakens it by calling :meth:`~Condition.notify` or :meth:`~Condition.notify_all`. Once awakened, :meth:`~Condition.wait` re-acquires the lock and returns. It is also possible to specify a timeout.
The :meth:`~Condition.notify` method wakes up one of the threads waiting for
the condition variable, if any ... | another thread awakens it by calling :meth:`~Condition.notify` or :meth:`~Condition.notify_all`. Once awakened, :meth:`~Condition.wait` re-acquires the lock and returns. It is also possible to specify a timeout.
The :meth:`~Condition.notify` method wakes up one of the threads waiting for
the condition variable, if any ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4de3d4c2-14bb-48d9-a032-260ae0b53f3e | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,437 | supabase-export-v2 | e6788038d4ea5461 | a reentrant lock, the same thread may acquire it again without blocking; the thread must release it once for each time it has acquired it.
Note that ``RLock`` is actually a factory function which returns an instance
of the most efficient version of the concrete RLock class that is supported
by the platform. | trusted_official_docs | CPython Docs | a reentrant lock, the same thread may acquire it again without blocking; the thread must release it once for each time it has acquired it.
Note that ``RLock`` is actually a factory function which returns an instance
of the most efficient version of the concrete RLock class that is supported
by the platform. | a reentrant lock, the same thread may acquire it again without blocking; the thread must release it once for each time it has acquired it.
Note that ``RLock`` is actually a factory function which returns an instance
of the most efficient version of the concrete RLock class that is supported
by the platform. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4e9c81f7-5b0f-4082-a92d-ae8fb7c0aa7c | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,383 | supabase-export-v2 | 20722cb7535702c3 | .. attribute:: name
A string used for identification purposes only. It has no semantics. Multiple threads may be given the same name. The initial name is set by
the constructor. | trusted_official_docs | CPython Docs | .. attribute:: name
A string used for identification purposes only. It has no semantics. Multiple threads may be given the same name. The initial name is set by
the constructor. | .. attribute:: name
A string used for identification purposes only. It has no semantics. Multiple threads may be given the same name. The initial name is set by
the constructor. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4f059f0c-3973-48ac-a5f8-ce36c81d9e0f | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,400 | supabase-export-v2 | 3a362622d37215a5 | the creating thread; the main thread is not a daemon thread and therefore all threads created in the main thread default to :attr:`~Thread.daemon` = ``False``.
The entire Python program exits when no alive non-daemon threads are left. | trusted_official_docs | CPython Docs | the creating thread; the main thread is not a daemon thread and therefore all threads created in the main thread default to :attr:`~Thread.daemon` = ``False``.
The entire Python program exits when no alive non-daemon threads are left. | the creating thread; the main thread is not a daemon thread and therefore all threads created in the main thread default to :attr:`~Thread.daemon` = ``False``.
The entire Python program exits when no alive non-daemon threads are left. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
511aaf08-414e-4338-89a4-e63aed33fbc2 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,236 | supabase-export-v2 | 3a4a5f453f6a4585 | GIL and performance considerations ----------------------------------
Unlike the :mod:`multiprocessing` module, which uses separate processes to
bypass the :term:`global interpreter lock` (GIL), the threading module operates
within a single process, meaning that all threads share the same memory space. However, the GIL... | trusted_official_docs | CPython Docs | GIL and performance considerations ----------------------------------
Unlike the :mod:`multiprocessing` module, which uses separate processes to
bypass the :term:`global interpreter lock` (GIL), the threading module operates
within a single process, meaning that all threads share the same memory space. However, the GIL... | GIL and performance considerations ----------------------------------
Unlike the :mod:`multiprocessing` module, which uses separate processes to
bypass the :term:`global interpreter lock` (GIL), the threading module operates
within a single process, meaning that all threads share the same memory space. However, the GIL... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
513a00e1-0dca-450d-bc9b-0a81578af46f | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,350 | supabase-export-v2 | 8fa5487e9164a09b | *group* should be ``None``; reserved for future extension when a :class:`!ThreadGroup` class is implemented.
*target* is the callable object to be invoked by the :meth:`run` method. Defaults to ``None``, meaning nothing is called. | trusted_official_docs | CPython Docs | *group* should be ``None``; reserved for future extension when a :class:`!ThreadGroup` class is implemented.
*target* is the callable object to be invoked by the :meth:`run` method. Defaults to ``None``, meaning nothing is called. | *group* should be ``None``; reserved for future extension when a :class:`!ThreadGroup` class is implemented.
*target* is the callable object to be invoked by the :meth:`run` method. Defaults to ``None``, meaning nothing is called. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
537f0966-abbe-43ab-83ce-7c8a82b073f0 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,497 | supabase-export-v2 | d5310e46953e8732 | .. method:: notify(n=1)
By default, wake up one thread waiting on this condition, if any. If the
calling thread has not acquired the lock when this method is called, a
:exc:`RuntimeError` is raised. | trusted_official_docs | CPython Docs | .. method:: notify(n=1)
By default, wake up one thread waiting on this condition, if any. If the
calling thread has not acquired the lock when this method is called, a
:exc:`RuntimeError` is raised. | .. method:: notify(n=1)
By default, wake up one thread waiting on this condition, if any. If the
calling thread has not acquired the lock when this method is called, a
:exc:`RuntimeError` is raised. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
57d7904b-f8fa-49b0-bab0-413746a140ae | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,430 | supabase-export-v2 | 3e9cd11ce3dca777 | to the locked/unlocked state used by primitive locks. In the locked state, some thread owns the lock; in the unlocked state, no thread owns it.
Threads call a lock's :meth:`~RLock.acquire` method to lock it,
and its :meth:`~Lock.release` method to unlock it. | trusted_official_docs | CPython Docs | to the locked/unlocked state used by primitive locks. In the locked state, some thread owns the lock; in the unlocked state, no thread owns it.
Threads call a lock's :meth:`~RLock.acquire` method to lock it,
and its :meth:`~Lock.release` method to unlock it. | to the locked/unlocked state used by primitive locks. In the locked state, some thread owns the lock; in the unlocked state, no thread owns it.
Threads call a lock's :meth:`~RLock.acquire` method to lock it,
and its :meth:`~Lock.release` method to unlock it. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5a3baec2-5af3-4497-bcc0-2132a4394b6f | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,356 | supabase-export-v2 | 76710bdef462bb2f | To explicitly start with a copy of the current context, pass the value from :func:`~contextvars.copy_context`. The flag defaults true on free-threaded builds and false otherwise.
If the subclass overrides the constructor, it must make sure to invoke the
base class constructor (``Thread.__init__()``) before doing anyth... | trusted_official_docs | CPython Docs | To explicitly start with a copy of the current context, pass the value from :func:`~contextvars.copy_context`. The flag defaults true on free-threaded builds and false otherwise.
If the subclass overrides the constructor, it must make sure to invoke the
base class constructor (``Thread.__init__()``) before doing anyth... | To explicitly start with a copy of the current context, pass the value from :func:`~contextvars.copy_context`. The flag defaults true on free-threaded builds and false otherwise.
If the subclass overrides the constructor, it must make sure to invoke the
base class constructor (``Thread.__init__()``) before doing anyth... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5b54f7af-f5bc-42f9-bf58-5554c92be70b | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,303 | supabase-export-v2 | 65394f77be10efb1 | This module defines a number of classes, which are detailed in the sections below.
The design of this module is loosely based on Java's threading model. However,
where Java makes locks and condition variables basic behavior of every object,
they are separate objects in Python. Python's :class:`Thread` class supports a
... | trusted_official_docs | CPython Docs | This module defines a number of classes, which are detailed in the sections below.
The design of this module is loosely based on Java's threading model. However,
where Java makes locks and condition variables basic behavior of every object,
they are separate objects in Python. Python's :class:`Thread` class supports a
... | This module defines a number of classes, which are detailed in the sections below.
The design of this module is loosely based on Java's threading model. However,
where Java makes locks and condition variables basic behavior of every object,
they are separate objects in Python. Python's :class:`Thread` class supports a
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5bcba3bd-912d-4b80-bfc0-8b080266df50 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,573 | supabase-export-v2 | 911fd3af4e36196a | .. method:: wait(timeout=None)
Pass the barrier. When all the threads party to the barrier have called
this function, they are all released simultaneously. If a *timeout* is
provided, it is used in preference to any that was supplied to the class
constructor. | trusted_official_docs | CPython Docs | .. method:: wait(timeout=None)
Pass the barrier. When all the threads party to the barrier have called
this function, they are all released simultaneously. If a *timeout* is
provided, it is used in preference to any that was supplied to the class
constructor. | .. method:: wait(timeout=None)
Pass the barrier. When all the threads party to the barrier have called
this function, they are all released simultaneously. If a *timeout* is
provided, it is used in preference to any that was supplied to the class
constructor. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5e15028a-3474-4d29-b5de-b62094e2baa9 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,434 | supabase-export-v2 | 0e6c18ec3f1c145e | the final :meth:`~RLock.release` (the :meth:`~Lock.release` of the outermost pair) resets the lock to an unlocked state and allows another thread blocked in :meth:`~RLock.acquire` to proceed.
:meth:`~RLock.acquire`/:meth:`~RLock.release` must be used in pairs: each acquire
must have a release in the thread that has acq... | trusted_official_docs | CPython Docs | the final :meth:`~RLock.release` (the :meth:`~Lock.release` of the outermost pair) resets the lock to an unlocked state and allows another thread blocked in :meth:`~RLock.acquire` to proceed.
:meth:`~RLock.acquire`/:meth:`~RLock.release` must be used in pairs: each acquire
must have a release in the thread that has acq... | the final :meth:`~RLock.release` (the :meth:`~Lock.release` of the outermost pair) resets the lock to an unlocked state and allows another thread blocked in :meth:`~RLock.acquire` to proceed.
:meth:`~RLock.acquire`/:meth:`~RLock.release` must be used in pairs: each acquire
must have a release in the thread that has acq... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5e23c55b-97ef-4ef4-a249-c30073c71152 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,361 | supabase-export-v2 | 659e3dc7b7c22e7b | Start the thread's activity.
It must be called at most once per thread object. It arranges for the
object's :meth:`~Thread.run` method to be invoked in a separate thread
of control. | trusted_official_docs | CPython Docs | Start the thread's activity.
It must be called at most once per thread object. It arranges for the
object's :meth:`~Thread.run` method to be invoked in a separate thread
of control. | Start the thread's activity.
It must be called at most once per thread object. It arranges for the
object's :meth:`~Thread.run` method to be invoked in a separate thread
of control. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5fbee129-0145-45f5-86f6-c014f51086a7 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,456 | supabase-export-v2 | 4a10f1cccbad9307 | one of them to proceed. If after the decrement the recursion level is still nonzero, the lock remains locked and owned by the calling thread.
Only call this method when the calling thread owns the lock. A
:exc:`RuntimeError` is raised if this method is called when the lock is
not acquired. | trusted_official_docs | CPython Docs | one of them to proceed. If after the decrement the recursion level is still nonzero, the lock remains locked and owned by the calling thread.
Only call this method when the calling thread owns the lock. A
:exc:`RuntimeError` is raised if this method is called when the lock is
not acquired. | one of them to proceed. If after the decrement the recursion level is still nonzero, the lock remains locked and owned by the calling thread.
Only call this method when the calling thread owns the lock. A
:exc:`RuntimeError` is raised if this method is called when the lock is
not acquired. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6409dc46-c57a-4353-bb88-43ca76ae00ef | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,367 | supabase-export-v2 | 814d9e01b043ea48 | Method representing the thread's activity.
You may override this method in a subclass. The standard :meth:`run`
method invokes the callable object passed to the object's constructor as
the *target* argument, if any, with positional and keyword arguments taken
from the *args* and *kwargs* arguments, respectively. | trusted_official_docs | CPython Docs | Method representing the thread's activity.
You may override this method in a subclass. The standard :meth:`run`
method invokes the callable object passed to the object's constructor as
the *target* argument, if any, with positional and keyword arguments taken
from the *args* and *kwargs* arguments, respectively. | Method representing the thread's activity.
You may override this method in a subclass. The standard :meth:`run`
method invokes the callable object passed to the object's constructor as
the *target* argument, if any, with positional and keyword arguments taken
from the *args* and *kwargs* arguments, respectively. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
67e93a67-961b-41e9-95e8-86de2a3792fa | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,503 | supabase-export-v2 | 089f3fd56c98651b | up all waiting threads instead of one. If the calling thread has not acquired the lock when this method is called, a :exc:`RuntimeError` is raised.
The method ``notifyAll`` is a deprecated alias for this method. | trusted_official_docs | CPython Docs | up all waiting threads instead of one. If the calling thread has not acquired the lock when this method is called, a :exc:`RuntimeError` is raised.
The method ``notifyAll`` is a deprecated alias for this method. | up all waiting threads instead of one. If the calling thread has not acquired the lock when this method is called, a :exc:`RuntimeError` is raised.
The method ``notifyAll`` is a deprecated alias for this method. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6c0ed409-25a1-4f91-8605-8af9c55c5baf | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,424 | supabase-export-v2 | ba6b43edc046557a | Release a lock. This can be called from any thread, not only the thread which has acquired the lock.
When the lock is locked, reset it to unlocked, and return. If any other threads
are blocked waiting for the lock to become unlocked, allow exactly one of them
to proceed. | trusted_official_docs | CPython Docs | Release a lock. This can be called from any thread, not only the thread which has acquired the lock.
When the lock is locked, reset it to unlocked, and return. If any other threads
are blocked waiting for the lock to become unlocked, allow exactly one of them
to proceed. | Release a lock. This can be called from any thread, not only the thread which has acquired the lock.
When the lock is locked, reset it to unlocked, and return. If any other threads
are blocked waiting for the lock to become unlocked, allow exactly one of them
to proceed. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6c9b949d-3acf-4c40-8908-dbfea97f0d2e | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,444 | supabase-export-v2 | 1255184cd8a8c10d | * If no thread owns the lock, acquire the lock and return immediately.
* If another thread owns the lock, block until we are able to acquire
lock, or *timeout*, if set to a positive value. | trusted_official_docs | CPython Docs | * If no thread owns the lock, acquire the lock and return immediately.
* If another thread owns the lock, block until we are able to acquire
lock, or *timeout*, if set to a positive value. | * If no thread owns the lock, acquire the lock and return immediately.
* If another thread owns the lock, block until we are able to acquire
lock, or *timeout*, if set to a positive value. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6ca8e875-0e17-43e2-9688-2fe8ca580dea | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,260 | supabase-export-v2 | 1624767f32f2e9a0 | .. function:: get_ident()
Return the 'thread identifier' of the current thread. This is a nonzero
integer. Its value has no direct meaning; it is intended as a magic cookie
to be used e.g. to index a dictionary of thread-specific data. Thread
identifiers may be recycled when a thread exits and another thread is
cre... | trusted_official_docs | CPython Docs | .. function:: get_ident()
Return the 'thread identifier' of the current thread. This is a nonzero
integer. Its value has no direct meaning; it is intended as a magic cookie
to be used e.g. to index a dictionary of thread-specific data. Thread
identifiers may be recycled when a thread exits and another thread is
cre... | .. function:: get_ident()
Return the 'thread identifier' of the current thread. This is a nonzero
integer. Its value has no direct meaning; it is intended as a magic cookie
to be used e.g. to index a dictionary of thread-specific data. Thread
identifiers may be recycled when a thread exits and another thread is
cre... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6cc4fced-c414-4409-ac3a-500febdf0c05 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,285 | supabase-export-v2 | 18241925a17d5d73 | .. index:: single: profile function
Set a profile function for all threads started from the :mod:`!threading` module. The *func* will be passed to :func:`sys.setprofile` for each thread, before its
:meth:`~Thread.run` method is called. | trusted_official_docs | CPython Docs | .. index:: single: profile function
Set a profile function for all threads started from the :mod:`!threading` module. The *func* will be passed to :func:`sys.setprofile` for each thread, before its
:meth:`~Thread.run` method is called. | .. index:: single: profile function
Set a profile function for all threads started from the :mod:`!threading` module. The *func* will be passed to :func:`sys.setprofile` for each thread, before its
:meth:`~Thread.run` method is called. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6d0f24a1-aad8-44f5-85f4-923344b33e10 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,618 | supabase-export-v2 | 4c6b7a6b288f2e5d | Wrap an iterator-producing callable so that each iterator it returns is automatically passed through :class:`serialize_iterator`.
This is especially useful as a :term:`decorator` for generator functions,
allowing their generator-iterators to be consumed from multiple threads. | trusted_official_docs | CPython Docs | Wrap an iterator-producing callable so that each iterator it returns is automatically passed through :class:`serialize_iterator`.
This is especially useful as a :term:`decorator` for generator functions,
allowing their generator-iterators to be consumed from multiple threads. | Wrap an iterator-producing callable so that each iterator it returns is automatically passed through :class:`serialize_iterator`.
This is especially useful as a :term:`decorator` for generator functions,
allowing their generator-iterators to be consumed from multiple threads. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6db99382-5d18-4fee-b7da-1a3610bcbdcb | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,452 | supabase-export-v2 | c2cf16331b8bf3c9 | multiple times, failing to call :meth:`~RLock.release` as many times may lead to deadlock. Consider using :class:`!RLock` as a context manager rather than calling acquire/release directly.
.. versionchanged:: 3.2
The *timeout* parameter is new. | trusted_official_docs | CPython Docs | multiple times, failing to call :meth:`~RLock.release` as many times may lead to deadlock. Consider using :class:`!RLock` as a context manager rather than calling acquire/release directly.
.. versionchanged:: 3.2
The *timeout* parameter is new. | multiple times, failing to call :meth:`~RLock.release` as many times may lead to deadlock. Consider using :class:`!RLock` as a context manager rather than calling acquire/release directly.
.. versionchanged:: 3.2
The *timeout* parameter is new. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6fe6a2da-4911-45ee-84da-ac6aee9355a8 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,319 | supabase-export-v2 | c201743072d27f2a | :py:meth:`~object.__init__` method, it will be called each time the :class:`local` object is used in a separate thread. This is necessary to initialize each thread's dictionary.
Now if we create a :class:`local` object:: | trusted_official_docs | CPython Docs | :py:meth:`~object.__init__` method, it will be called each time the :class:`local` object is used in a separate thread. This is necessary to initialize each thread's dictionary.
Now if we create a :class:`local` object:: | :py:meth:`~object.__init__` method, it will be called each time the :class:`local` object is used in a separate thread. This is necessary to initialize each thread's dictionary.
Now if we create a :class:`local` object:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
70ed41b4-5a8b-44c7-9c31-92da6c4de864 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,243 | supabase-export-v2 | a8d25cd62e7c2db6 | Return the number of :class:`Thread` objects currently alive. The returned count is equal to the length of the list returned by :func:`.enumerate`.
The function ``activeCount`` is a deprecated alias for this function. | trusted_official_docs | CPython Docs | Return the number of :class:`Thread` objects currently alive. The returned count is equal to the length of the list returned by :func:`.enumerate`.
The function ``activeCount`` is a deprecated alias for this function. | Return the number of :class:`Thread` objects currently alive. The returned count is equal to the length of the list returned by :func:`.enumerate`.
The function ``activeCount`` is a deprecated alias for this function. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7262f841-f6e3-4bca-901e-127a427849be | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,583 | supabase-export-v2 | ece9058175e9b865 | .. method:: abort()
Put the barrier into a broken state. This causes any active or future
calls to :meth:`wait` to fail with the :class:`BrokenBarrierError`. Use
this for example if one of the threads needs to abort, to avoid deadlocking the
application. | trusted_official_docs | CPython Docs | .. method:: abort()
Put the barrier into a broken state. This causes any active or future
calls to :meth:`wait` to fail with the :class:`BrokenBarrierError`. Use
this for example if one of the threads needs to abort, to avoid deadlocking the
application. | .. method:: abort()
Put the barrier into a broken state. This causes any active or future
calls to :meth:`wait` to fail with the :class:`BrokenBarrierError`. Use
this for example if one of the threads needs to abort, to avoid deadlocking the
application. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
730ee248-dbbf-440b-8b77-659b9f15ed3e | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,565 | supabase-export-v2 | 13ecef1f2d097e82 | calling the :meth:`~Barrier.wait` method and will block until all of the threads have made their :meth:`~Barrier.wait` calls. At this point, the threads are released simultaneously.
The barrier can be reused any number of times for the same number of threads. | trusted_official_docs | CPython Docs | calling the :meth:`~Barrier.wait` method and will block until all of the threads have made their :meth:`~Barrier.wait` calls. At this point, the threads are released simultaneously.
The barrier can be reused any number of times for the same number of threads. | calling the :meth:`~Barrier.wait` method and will block until all of the threads have made their :meth:`~Barrier.wait` calls. At this point, the threads are released simultaneously.
The barrier can be reused any number of times for the same number of threads. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7411d03f-d9d2-4d66-a0a3-33f2f504d835 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,571 | supabase-export-v2 | e665eeaef6843bf2 | .. class:: Barrier(parties, action=None, timeout=None)
Create a barrier object for *parties* number of threads. An *action*, when
provided, is a callable to be called by one of the threads when they are
released. *timeout* is the default timeout value if none is specified for
the :meth:`wait` method. | trusted_official_docs | CPython Docs | .. class:: Barrier(parties, action=None, timeout=None)
Create a barrier object for *parties* number of threads. An *action*, when
provided, is a callable to be called by one of the threads when they are
released. *timeout* is the default timeout value if none is specified for
the :meth:`wait` method. | .. class:: Barrier(parties, action=None, timeout=None)
Create a barrier object for *parties* number of threads. An *action*, when
provided, is a callable to be called by one of the threads when they are
released. *timeout* is the default timeout value if none is specified for
the :meth:`wait` method. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7a47b0f7-be6d-4462-8cbe-7aa9fe07be98 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,294 | supabase-export-v2 | 990f105c22010e65 | .. function:: stack_size([size])
Return the thread stack size used when creating new threads. The optional
*size* argument specifies the stack size to be used for subsequently created
threads, and must be 0 (use platform or configured default) or a positive
integer value of at least 32,768 (32 KiB). If *size* is not... | trusted_official_docs | CPython Docs | .. function:: stack_size([size])
Return the thread stack size used when creating new threads. The optional
*size* argument specifies the stack size to be used for subsequently created
threads, and must be 0 (use platform or configured default) or a positive
integer value of at least 32,768 (32 KiB). If *size* is not... | .. function:: stack_size([size])
Return the thread stack size used when creating new threads. The optional
*size* argument specifies the stack size to be used for subsequently created
threads, and must be 0 (use platform or configured default) or a positive
integer value of at least 32,768 (32 KiB). If *size* is not... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7bd97e10-6eab-4153-8042-7a28b8df767e | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,510 | supabase-export-v2 | bba2b02b946fc9a1 | .. class:: Semaphore(value=1)
This class implements semaphore objects. A semaphore manages an atomic
counter representing the number of :meth:`release` calls minus the number of
:meth:`acquire` calls, plus an initial value. The :meth:`acquire` method
blocks if necessary until it can return without making the counter... | trusted_official_docs | CPython Docs | .. class:: Semaphore(value=1)
This class implements semaphore objects. A semaphore manages an atomic
counter representing the number of :meth:`release` calls minus the number of
:meth:`acquire` calls, plus an initial value. The :meth:`acquire` method
blocks if necessary until it can return without making the counter... | .. class:: Semaphore(value=1)
This class implements semaphore objects. A semaphore manages an atomic
counter representing the number of :meth:`release` calls minus the number of
:meth:`acquire` calls, plus an initial value. The :meth:`acquire` method
blocks if necessary until it can return without making the counter... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7ed7c2c2-b274-40f4-944d-fbf73d41f24c | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,614 | supabase-export-v2 | 7934f029aaf1dcf8 | t1 = threading.Thread(target=consume, args=("left", source)) t2 = threading.Thread(target=consume, args=("right", source)) t1.start() t2.start() t1.join() t2.join()
In this example, each number is printed exactly once, but the work is shared
between the two threads. | trusted_official_docs | CPython Docs | t1 = threading.Thread(target=consume, args=("left", source)) t2 = threading.Thread(target=consume, args=("right", source)) t1.start() t2.start() t1.join() t2.join()
In this example, each number is printed exactly once, but the work is shared
between the two threads. | t1 = threading.Thread(target=consume, args=("left", source)) t2 = threading.Thread(target=consume, args=("right", source)) t1.start() t2.start() t1.join() t2.join()
In this example, each number is printed exactly once, but the work is shared
between the two threads. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
802d8345-cc45-4208-a9be-ea4fa660643a | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,607 | supabase-export-v2 | 6c3d59c36a0c9071 | If the wrapped iterator also defines :meth:`~generator.send`, :meth:`~generator.throw`, or :meth:`~generator.close`, those calls are serialized as well.
This makes it possible to share a single iterator, including a generator
iterator, between multiple threads. A lock ensures that calls are handled
one at a time. No ... | trusted_official_docs | CPython Docs | If the wrapped iterator also defines :meth:`~generator.send`, :meth:`~generator.throw`, or :meth:`~generator.close`, those calls are serialized as well.
This makes it possible to share a single iterator, including a generator
iterator, between multiple threads. A lock ensures that calls are handled
one at a time. No ... | If the wrapped iterator also defines :meth:`~generator.send`, :meth:`~generator.throw`, or :meth:`~generator.close`, those calls are serialized as well.
This makes it possible to share a single iterator, including a generator
iterator, between multiple threads. A lock ensures that calls are handled
one at a time. No ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
80b8d9bb-03e9-4a65-80ee-b2c2c3ca9f3f | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,251 | supabase-export-v2 | 36835c2e84697993 | type. * *exc_value*: Exception value, can be ``None``. * *exc_traceback*: Exception traceback, can be ``None``. * *thread*: Thread which raised the exception, can be ``None``.
If *exc_type* is :exc:`SystemExit`, the exception is silently ignored. Otherwise, the exception is printed out on :data:`sys.stderr`. | trusted_official_docs | CPython Docs | type. * *exc_value*: Exception value, can be ``None``. * *exc_traceback*: Exception traceback, can be ``None``. * *thread*: Thread which raised the exception, can be ``None``.
If *exc_type* is :exc:`SystemExit`, the exception is silently ignored. Otherwise, the exception is printed out on :data:`sys.stderr`. | type. * *exc_value*: Exception value, can be ``None``. * *exc_traceback*: Exception traceback, can be ``None``. * *thread*: Thread which raised the exception, can be ``None``.
If *exc_type* is :exc:`SystemExit`, the exception is silently ignored. Otherwise, the exception is printed out on :data:`sys.stderr`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
84c4b170-9229-42de-a0d9-c19a85ade6c7 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,507 | supabase-export-v2 | d86499acd9b1f795 | of computer science, invented by the early Dutch computer scientist Edsger W. Dijkstra (he used the names ``P()`` and ``V()`` instead of :meth:`~Semaphore.acquire` and :meth:`~Semaphore.release`).
A semaphore manages an internal counter which is decremented by each
:meth:`~Semaphore.acquire` call and incremented by eac... | trusted_official_docs | CPython Docs | of computer science, invented by the early Dutch computer scientist Edsger W. Dijkstra (he used the names ``P()`` and ``V()`` instead of :meth:`~Semaphore.acquire` and :meth:`~Semaphore.release`).
A semaphore manages an internal counter which is decremented by each
:meth:`~Semaphore.acquire` call and incremented by eac... | of computer science, invented by the early Dutch computer scientist Edsger W. Dijkstra (he used the names ``P()`` and ``V()`` instead of :meth:`~Semaphore.acquire` and :meth:`~Semaphore.release`).
A semaphore manages an internal counter which is decremented by each
:meth:`~Semaphore.acquire` call and incremented by eac... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
84fc8085-6470-4f2f-96be-bc08e20c1739 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,313 | supabase-export-v2 | d748765fcfe757c2 | >>> import threading >>> thread = threading.Thread(target=f) >>> thread.start() >>> thread.join() >>> log [[], 11]
we get different data. Furthermore, changes made in the other thread
don't affect data seen in this thread:: | trusted_official_docs | CPython Docs | >>> import threading >>> thread = threading.Thread(target=f) >>> thread.start() >>> thread.join() >>> log [[], 11]
we get different data. Furthermore, changes made in the other thread
don't affect data seen in this thread:: | >>> import threading >>> thread = threading.Thread(target=f) >>> thread.start() >>> thread.join() >>> log [[], 11]
we get different data. Furthermore, changes made in the other thread
don't affect data seen in this thread:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
856c3aab-5181-4763-afd1-a894b72c831c | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,577 | supabase-export-v2 | 180c07e428f2b23f | of the threads will have called it prior to being released. Should this call raise an error, the barrier is put into the broken state.
If the call times out, the barrier is put into the broken state. | trusted_official_docs | CPython Docs | of the threads will have called it prior to being released. Should this call raise an error, the barrier is put into the broken state.
If the call times out, the barrier is put into the broken state. | of the threads will have called it prior to being released. Should this call raise an error, the barrier is put into the broken state.
If the call times out, the barrier is put into the broken state. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
86dc988f-de2f-41e8-b0b4-14bcc67f962c | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,230 | supabase-export-v2 | 905b5731d13dab0d | :mod:`queue` provides a thread-safe interface for exchanging data between running threads.
:mod:`asyncio` offers an alternative approach to achieving task level
concurrency without requiring the use of multiple operating system threads. | trusted_official_docs | CPython Docs | :mod:`queue` provides a thread-safe interface for exchanging data between running threads.
:mod:`asyncio` offers an alternative approach to achieving task level
concurrency without requiring the use of multiple operating system threads. | :mod:`queue` provides a thread-safe interface for exchanging data between running threads.
:mod:`asyncio` offers an alternative approach to achieving task level
concurrency without requiring the use of multiple operating system threads. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
88051822-495b-4374-8a4d-dab2add28064 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,317 | supabase-export-v2 | 15ebbc00b3bbb50e | You can create custom :class:`local` objects by subclassing the :class:`local` class::
>>> class MyLocal(local):
... number = 2
... def __init__(self, /, **kw):
... self.__dict__.update(kw)
... def squared(self):
... return self.number ** 2 | trusted_official_docs | CPython Docs | You can create custom :class:`local` objects by subclassing the :class:`local` class::
>>> class MyLocal(local):
... number = 2
... def __init__(self, /, **kw):
... self.__dict__.update(kw)
... def squared(self):
... return self.number ** 2 | You can create custom :class:`local` objects by subclassing the :class:`local` class::
>>> class MyLocal(local):
... number = 2
... def __init__(self, /, **kw):
... self.__dict__.update(kw)
... def squared(self):
... return self.number ** 2 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
89d81211-7d27-413e-89f1-259741e032fa | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,544 | supabase-export-v2 | 3691128fdd57bb72 | .. method:: set()
Set the internal flag to true. All threads waiting for it to become true
are awakened. Threads that call :meth:`wait` once the flag is true will
not block at all. | trusted_official_docs | CPython Docs | .. method:: set()
Set the internal flag to true. All threads waiting for it to become true
are awakened. Threads that call :meth:`wait` once the flag is true will
not block at all. | .. method:: set()
Set the internal flag to true. All threads waiting for it to become true
are awakened. Threads that call :meth:`wait` once the flag is true will
not block at all. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8a0b9773-23fb-49e7-ae6b-2cdbfea9c313 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,451 | supabase-export-v2 | 7070253c7a02154a | acquire the lock, return ``True``. If the thread was unable to acquire the lock (i.e. if not blocking or the timeout was reached) return ``False``.
If called multiple times, failing to call :meth:`~RLock.release` as many times
may lead to deadlock. Consider using :class:`!RLock` as a context manager rather than
calli... | trusted_official_docs | CPython Docs | acquire the lock, return ``True``. If the thread was unable to acquire the lock (i.e. if not blocking or the timeout was reached) return ``False``.
If called multiple times, failing to call :meth:`~RLock.release` as many times
may lead to deadlock. Consider using :class:`!RLock` as a context manager rather than
calli... | acquire the lock, return ``True``. If the thread was unable to acquire the lock (i.e. if not blocking or the timeout was reached) return ``False``.
If called multiple times, failing to call :meth:`~RLock.release` as many times
may lead to deadlock. Consider using :class:`!RLock` as a context manager rather than
calli... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8b71fc94-39f8-4c46-a473-0ca54330b5c3 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,548 | supabase-export-v2 | be8c1735f67f1a55 | .. method:: wait(timeout=None)
Block as long as the internal flag is false and the timeout, if given,
has not expired. The return value represents the
reason that this blocking method returned; ``True`` if returning because
the internal flag is set to true, or ``False`` if a timeout is given and
the internal flag d... | trusted_official_docs | CPython Docs | .. method:: wait(timeout=None)
Block as long as the internal flag is false and the timeout, if given,
has not expired. The return value represents the
reason that this blocking method returned; ``True`` if returning because
the internal flag is set to true, or ``False`` if a timeout is given and
the internal flag d... | .. method:: wait(timeout=None)
Block as long as the internal flag is false and the timeout, if given,
has not expired. The return value represents the
reason that this blocking method returned; ``True`` if returning because
the internal flag is set to true, or ``False`` if a timeout is given and
the internal flag d... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8cbc0321-ce79-48fb-8bf4-9d94a536c5b0 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,337 | supabase-export-v2 | a6686a360d966476 | Thread objects ^^^^^^^^^^^^^^
The :class:`Thread` class represents an activity that is run in a separate
thread of control. There are two ways to specify the activity: by passing a
callable object to the constructor, or by overriding the :meth:`~Thread.run`
method in a subclass. No other methods (except for the constru... | trusted_official_docs | CPython Docs | Thread objects ^^^^^^^^^^^^^^
The :class:`Thread` class represents an activity that is run in a separate
thread of control. There are two ways to specify the activity: by passing a
callable object to the constructor, or by overriding the :meth:`~Thread.run`
method in a subclass. No other methods (except for the constru... | Thread objects ^^^^^^^^^^^^^^
The :class:`Thread` class represents an activity that is run in a separate
thread of control. There are two ways to specify the activity: by passing a
callable object to the constructor, or by overriding the :meth:`~Thread.run`
method in a subclass. No other methods (except for the constru... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8cc50a96-91bb-4d1c-baa6-41862d3f982b | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,566 | supabase-export-v2 | 496cbdfb1baa36fc | The barrier can be reused any number of times for the same number of threads.
As an example, here is a simple way to synchronize a client and server thread:: | trusted_official_docs | CPython Docs | The barrier can be reused any number of times for the same number of threads.
As an example, here is a simple way to synchronize a client and server thread:: | The barrier can be reused any number of times for the same number of threads.
As an example, here is a simple way to synchronize a client and server thread:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8df6e229-4873-4fc9-a4ec-de351a1b84b6 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,417 | supabase-export-v2 | 7c6c174324c72c77 | the lock cannot be acquired. A *timeout* argument of ``-1`` specifies an unbounded wait. It is forbidden to specify a *timeout* when *blocking* is ``False``.
The return value is ``True`` if the lock is acquired successfully,
``False`` if not (for example if the *timeout* expired). | trusted_official_docs | CPython Docs | the lock cannot be acquired. A *timeout* argument of ``-1`` specifies an unbounded wait. It is forbidden to specify a *timeout* when *blocking* is ``False``.
The return value is ``True`` if the lock is acquired successfully,
``False`` if not (for example if the *timeout* expired). | the lock cannot be acquired. A *timeout* argument of ``-1`` specifies an unbounded wait. It is forbidden to specify a *timeout* when *blocking* is ``False``.
The return value is ``True`` if the lock is acquired successfully,
``False`` if not (for example if the *timeout* expired). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8f6de3c8-e79a-4a1e-8585-c7a982c33ae0 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,420 | supabase-export-v2 | e70c070b0dfe0ea8 | .. versionchanged:: 3.2 Lock acquisition can now be interrupted by signals on POSIX if the underlying threading implementation supports it.
.. versionchanged:: 3.14
Lock acquisition can now be interrupted by signals on Windows. | trusted_official_docs | CPython Docs | .. versionchanged:: 3.2 Lock acquisition can now be interrupted by signals on POSIX if the underlying threading implementation supports it.
.. versionchanged:: 3.14
Lock acquisition can now be interrupted by signals on Windows. | .. versionchanged:: 3.2 Lock acquisition can now be interrupted by signals on POSIX if the underlying threading implementation supports it.
.. versionchanged:: 3.14
Lock acquisition can now be interrupted by signals on Windows. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8fa3390c-6e94-4aca-a435-adc83bda48e7 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,288 | supabase-export-v2 | 042b024a8875733e | Set a profile function for all threads started from the :mod:`!threading` module and all Python threads that are currently executing.
The *func* will be passed to :func:`sys.setprofile` for each thread, before its
:meth:`~Thread.run` method is called. | trusted_official_docs | CPython Docs | Set a profile function for all threads started from the :mod:`!threading` module and all Python threads that are currently executing.
The *func* will be passed to :func:`sys.setprofile` for each thread, before its
:meth:`~Thread.run` method is called. | Set a profile function for all threads started from the :mod:`!threading` module and all Python threads that are currently executing.
The *func* will be passed to :func:`sys.setprofile` for each thread, before its
:meth:`~Thread.run` method is called. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
90bea470-7108-4f05-b520-64c193ae8354 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,465 | supabase-export-v2 | eec69e82145593aa | one of the threads waiting for the condition variable, if any are waiting. The :meth:`~Condition.notify_all` method wakes up all threads waiting for the condition variable.
Note: the :meth:`~Condition.notify` and :meth:`~Condition.notify_all` methods
don't release the lock; this means that the thread or threads awakene... | trusted_official_docs | CPython Docs | one of the threads waiting for the condition variable, if any are waiting. The :meth:`~Condition.notify_all` method wakes up all threads waiting for the condition variable.
Note: the :meth:`~Condition.notify` and :meth:`~Condition.notify_all` methods
don't release the lock; this means that the thread or threads awakene... | one of the threads waiting for the condition variable, if any are waiting. The :meth:`~Condition.notify_all` method wakes up all threads waiting for the condition variable.
Note: the :meth:`~Condition.notify` and :meth:`~Condition.notify_all` methods
don't release the lock; this means that the thread or threads awakene... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
91b21d5d-b018-4e75-8bdc-263cefb22ab9 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,637 | supabase-export-v2 | 136984d699437998 | t1 = threading.Thread(target=consume, args=("left", left)) t2 = threading.Thread(target=consume, args=("right", right)) t1.start() t2.start() t1.join() t2.join()
In this example, both consumer threads see the full sequence of squares
from a single generator expression. | trusted_official_docs | CPython Docs | t1 = threading.Thread(target=consume, args=("left", left)) t2 = threading.Thread(target=consume, args=("right", right)) t1.start() t2.start() t1.join() t2.join()
In this example, both consumer threads see the full sequence of squares
from a single generator expression. | t1 = threading.Thread(target=consume, args=("left", left)) t2 = threading.Thread(target=consume, args=("right", right)) t1.start() t2.start() t1.join() t2.join()
In this example, both consumer threads see the full sequence of squares
from a single generator expression. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
91f3f219-1f4d-4f06-9704-6d9b362b2de8 | CPython Docs | file://datasets/cpython/Doc/library/threading.rst | unknown | 803f0533-1359-49ee-b5f5-632bde546d27 | 15,559 | supabase-export-v2 | 34ca3edf004539b8 | *args* is ``None`` (the default) then an empty list will be used. If *kwargs* is ``None`` (the default) then an empty dict will be used.
.. versionchanged:: 3.3
changed from a factory function to a class. | trusted_official_docs | CPython Docs | *args* is ``None`` (the default) then an empty list will be used. If *kwargs* is ``None`` (the default) then an empty dict will be used.
.. versionchanged:: 3.3
changed from a factory function to a class. | *args* is ``None`` (the default) then an empty list will be used. If *kwargs* is ``None`` (the default) then an empty dict will be used.
.. versionchanged:: 3.3
changed from a factory function to a class. | python, official-docs, cpython, P0 | Local_Trusted_Corpus |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.