Skip to main content

计时器池管理器
作用:
将多个计时器挂在到计时器管理器中, 用一个线程来统一管理, 减少资源消耗
别的多线程计时器在线程切换时会造成额外资源消耗
管理线程会根据在创建第一个计时器时自动启动, 关闭最后一个计时器后自动关闭
注意:
尽量不要调用Timer_Manager()中的close(), add_timer(), remove_timer()函数, 除非你真的完全了解这个模块
在计时器回调函数中调用close(), add_timer(), remove_timer()函数会造成死锁

测试代码:
if __name__ == '__main__':
def fun1(t: Timer):
print('回调', t.meta, t.callback_count, time.strftime(' %H:%M:%S', time.localtime()))


def fun_de(t: Timer):
print(t.meta, '关闭')


import time

t1 = Timer(fun1, 1, 5, close_callback=fun_de, meta='计时器1 ')
t1.start()

time.sleep(0.5)
t2 = Timer(fun1, 1, 2, meta=' 计时器2 ')
t2.start()

print('等待计时器1结束')
t1.join()
print('结束')


Metadata

Release files for ztimer 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ztimer 1.0.5
File Size Uploaded Provenance
ztimer-1.0.5.tar.gz 3.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ztimer 1.0.5
File Interpreter ABI Platform
ztimer-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 7.4 kB

Release files / ztimer-1.0.5.tar.gz

Download URL ztimer-1.0.5.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e8d3dcdaa61d2f839c367a692e30ad0cb9178a34514a80f263b1eb6ffec4e7fe
BLAKE2b-256 checksum
How to use checksums
01d2724749d5901ebef4514a37967ce1203e612dc25704aa03736dbf6aba39cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5

Release files / ztimer-1.0.5-py3-none-any.whl

Download URL ztimer-1.0.5-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0cd47e143ca851b6590fed3462d93d6ca318e150447e8bdd98a71634625c373e
BLAKE2b-256 checksum
How to use checksums
84645308e7e7a351b91a1c230a76d709f8791d4af7ba3c54dc12fbedff9a3be8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5

Security for ztimer 1.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.0.5 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page