ez-a-sync 0.32.25__cp312-cp312-macosx_11_0_arm64.whl → 0.32.27__cp312-cp312-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ez-a-sync might be problematic. Click here for more details.
- a_sync/_smart.c +9063 -8837
- a_sync/_smart.cpython-312-darwin.so +0 -0
- a_sync/a_sync/_descriptor.c +7787 -7011
- a_sync/a_sync/_descriptor.cpython-312-darwin.so +0 -0
- a_sync/a_sync/_flags.c +1806 -1528
- a_sync/a_sync/_flags.cpython-312-darwin.so +0 -0
- a_sync/a_sync/_helpers.c +4716 -4173
- a_sync/a_sync/_helpers.cpython-312-darwin.so +0 -0
- a_sync/a_sync/_kwargs.c +5017 -3786
- a_sync/a_sync/_kwargs.cpython-312-darwin.so +0 -0
- a_sync/a_sync/abstract.c +5024 -4138
- a_sync/a_sync/abstract.cpython-312-darwin.so +0 -0
- a_sync/a_sync/base.c +5982 -5010
- a_sync/a_sync/base.cpython-312-darwin.so +0 -0
- a_sync/a_sync/flags.c +2303 -1405
- a_sync/a_sync/flags.cpython-312-darwin.so +0 -0
- a_sync/a_sync/function.c +14448 -14471
- a_sync/a_sync/function.cpython-312-darwin.so +0 -0
- a_sync/a_sync/method.c +10891 -11483
- a_sync/a_sync/method.cpython-312-darwin.so +0 -0
- a_sync/a_sync/modifiers/manager.c +6700 -5360
- a_sync/a_sync/modifiers/manager.cpython-312-darwin.so +0 -0
- a_sync/a_sync/property.c +12830 -13699
- a_sync/a_sync/property.cpython-312-darwin.so +0 -0
- a_sync/a_sync/property.pyx +2 -3
- a_sync/async_property/cached.c +7498 -7763
- a_sync/async_property/cached.cpython-312-darwin.so +0 -0
- a_sync/async_property/proxy.c +12655 -14315
- a_sync/async_property/proxy.cpython-312-darwin.so +0 -0
- a_sync/asyncio/as_completed.c +7112 -6773
- a_sync/asyncio/as_completed.cpython-312-darwin.so +0 -0
- a_sync/asyncio/create_task.c +6119 -5206
- a_sync/asyncio/create_task.cpython-312-darwin.so +0 -0
- a_sync/asyncio/gather.c +6347 -5697
- a_sync/asyncio/gather.cpython-312-darwin.so +0 -0
- a_sync/asyncio/igather.c +5220 -4624
- a_sync/asyncio/igather.cpython-312-darwin.so +0 -0
- a_sync/asyncio/sleep.c +3667 -3087
- a_sync/asyncio/sleep.cpython-312-darwin.so +0 -0
- a_sync/debugging.c +6026 -5874
- a_sync/debugging.cpython-312-darwin.so +0 -0
- a_sync/exceptions.c +5406 -5368
- a_sync/exceptions.cpython-312-darwin.so +0 -0
- a_sync/executor.py +44 -0
- a_sync/functools.c +5124 -4057
- a_sync/functools.cpython-312-darwin.so +0 -0
- a_sync/iter.c +14595 -14787
- a_sync/iter.cpython-312-darwin.so +0 -0
- a_sync/primitives/_debug.c +5729 -4823
- a_sync/primitives/_debug.cpython-312-darwin.so +0 -0
- a_sync/primitives/_loggable.c +4418 -3448
- a_sync/primitives/_loggable.cpython-312-darwin.so +0 -0
- a_sync/primitives/locks/counter.c +6517 -6130
- a_sync/primitives/locks/counter.cpython-312-darwin.so +0 -0
- a_sync/primitives/locks/event.c +6465 -5579
- a_sync/primitives/locks/event.cpython-312-darwin.so +0 -0
- a_sync/primitives/locks/prio_semaphore.c +9077 -8516
- a_sync/primitives/locks/prio_semaphore.cpython-312-darwin.so +0 -0
- a_sync/primitives/locks/semaphore.c +8645 -7949
- a_sync/primitives/locks/semaphore.cpython-312-darwin.so +0 -0
- a_sync/utils/repr.c +5929 -4759
- a_sync/utils/repr.cpython-312-darwin.so +0 -0
- {ez_a_sync-0.32.25.dist-info → ez_a_sync-0.32.27.dist-info}/METADATA +2 -2
- {ez_a_sync-0.32.25.dist-info → ez_a_sync-0.32.27.dist-info}/RECORD +67 -67
- {ez_a_sync-0.32.25.dist-info → ez_a_sync-0.32.27.dist-info}/WHEEL +0 -0
- {ez_a_sync-0.32.25.dist-info → ez_a_sync-0.32.27.dist-info}/licenses/LICENSE.txt +0 -0
- {ez_a_sync-0.32.25.dist-info → ez_a_sync-0.32.27.dist-info}/top_level.txt +0 -0
|
Binary file
|
a_sync/executor.py
CHANGED
|
@@ -15,9 +15,11 @@ See Also:
|
|
|
15
15
|
"""
|
|
16
16
|
|
|
17
17
|
import asyncio
|
|
18
|
+
import atexit
|
|
18
19
|
import concurrent.futures
|
|
19
20
|
import multiprocessing.context
|
|
20
21
|
import queue
|
|
22
|
+
import signal
|
|
21
23
|
import threading
|
|
22
24
|
import weakref
|
|
23
25
|
from asyncio import sleep
|
|
@@ -27,6 +29,47 @@ from concurrent.futures import _base, thread
|
|
|
27
29
|
from a_sync._typing import *
|
|
28
30
|
from a_sync.primitives._debug import _DebugDaemonMixin
|
|
29
31
|
|
|
32
|
+
# === Executor Shutdown Logic ===
|
|
33
|
+
# All executors (module-level and user-created) are registered for shutdown on interpreter exit and signals.
|
|
34
|
+
# Signal handlers are chainable: after our cleanup, the previous handler is called (unless SIG_DFL or SIG_IGN).
|
|
35
|
+
# This ensures compatibility with other libraries and deduplicates shutdown logic.
|
|
36
|
+
|
|
37
|
+
_EXECUTORS = set()
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def register_executor(executor) -> None:
|
|
41
|
+
"""Register an executor for shutdown on exit/signals."""
|
|
42
|
+
_EXECUTORS.add(executor)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _shutdown_all_executors(*args) -> None:
|
|
46
|
+
"""Shutdown all registered executors (non-blocking)."""
|
|
47
|
+
for executor in list(_EXECUTORS):
|
|
48
|
+
try:
|
|
49
|
+
executor.shutdown(wait=False)
|
|
50
|
+
except Exception:
|
|
51
|
+
pass
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _register_executor_shutdown() -> None:
|
|
55
|
+
"""Register atexit and chainable signal handlers for executor shutdown."""
|
|
56
|
+
atexit.register(_shutdown_all_executors)
|
|
57
|
+
|
|
58
|
+
def make_chainable_signal_handler(signalnum):
|
|
59
|
+
prev_handler = signal.getsignal(signalnum)
|
|
60
|
+
|
|
61
|
+
def handler(signum, frame):
|
|
62
|
+
_shutdown_all_executors()
|
|
63
|
+
if callable(prev_handler) and prev_handler not in (signal.SIG_DFL, signal.SIG_IGN):
|
|
64
|
+
prev_handler(signum, frame)
|
|
65
|
+
|
|
66
|
+
signal.signal(signalnum, handler)
|
|
67
|
+
|
|
68
|
+
make_chainable_signal_handler(signal.SIGINT)
|
|
69
|
+
make_chainable_signal_handler(signal.SIGTERM)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
_register_executor_shutdown()
|
|
30
73
|
|
|
31
74
|
TEN_MINUTES = 60 * 10
|
|
32
75
|
|
|
@@ -209,6 +252,7 @@ class _AsyncExecutorMixin(concurrent.futures.Executor, _DebugDaemonMixin):
|
|
|
209
252
|
def __init_mixin__(self):
|
|
210
253
|
self.sync_mode = self._max_workers == 0
|
|
211
254
|
self.__super_submit = super().submit
|
|
255
|
+
register_executor(self)
|
|
212
256
|
|
|
213
257
|
async def _debug_daemon(self, fut: asyncio.Future, fn, *args, **kwargs) -> None:
|
|
214
258
|
"""
|