Irelandmiguelgrinberg/greenletio
Asyncio integration with sync code using greenlets.
🔄 Giao tiếp giữa đồng bộ và bất đồng bộ bằng greenlet
Greenletio dùng greenlet để chạy hàm đồng bộ như awaitable, tránh thread/process pool.
Greenletio của Miguel Grinberg giúp hàm đồng bộ và bất đồng bộ cùng hoạt động trong một asyncio event loop. Khác với cách dùng executor, greenletio không tạo thread/process mới.
✨ Điểm nổi bật
- Chuyển sync thành awaitable:
@async_biến hàm đồng bộ thành coroutine, dùngawaittrực tiếp. - Dùng await trong sync function:
await_()gọi coroutine từ hàm đồng bộ. - Gọi async như hàm thường:
@await_biến hàm bất đồng bộ thành hàm đồng bộ. - Không dùng thread/process pool: Dựa trên greenlet, nhẹ và nhanh.
- Tích hợp asyncio: Hoạt động trong event loop chuẩn.
💡 Vì sao đáng chú ý
Greenletio khác biệt vì dùng greenlet — cơ chế chuyển context nhẹ — thay vì thread pool. Phù hợp khi cần gọi thư viện đồng bộ trong mã bất đồng bộ mà không muốn overhead của thread.
#asyncio #greenlet #async-await #Python #TiniX
Dự án tương tự
Khám phá các dự án và mô hình AI khác có sự tương đồng.
High level asynchronous concurrency and networking framework that works on top of either Trio or asyncio
AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
The AI that really does things. Any OS. Any Platform. The lobster way. 🦞
An agentic skills framework & software development methodology that works.
all-MiniLM-L6-v2 This is a sentence-transformers(https://www.SBERT.net) model: It maps sentences & paragraphs to a 384 dimensional dense vector space and can be used for tasks like clustering or semantic search. Usage (Sentence-Transformers) Using t...
Free domain registration and practical DNS learning resources for everyone.
Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥