RepositoryPythonIEIreland
miguelgrinberg

miguelgrinberg/greenletio

Asyncio integration with sync code using greenlets.

164sao
8fork
2issue
0lượt xem

🔄 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ùng await trự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.

RepositoryPython
gevent/gevent

Coroutine-based concurrency library for Python

6.4k
Sep 16, 2026
RepositoryPython
agronholm/anyio

High level asynchronous concurrency and networking framework that works on top of either Trio or asyncio

2.6k
Oct 20, 2026
RepositoryCython
MagicStack/uvloop

Ultra fast asyncio event loop.

11.9k
Oct 19, 2026
RepositoryPython
Significant-Gravitas/AutoGPT

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.

187.7k
Oct 24, 2026
RepositoryTypeScript
openclaw/openclaw

The AI that really does things. Any OS. Any Platform. The lobster way. 🦞

393.0k
Oct 25, 2026
RepositoryShell
obra/superpowers

An agentic skills framework & software development methodology that works.

305.5k
Oct 23, 2026
Modelsentence-similarity
sentence-transformers/all-MiniLM-L6-v2

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...

♥0
190.2M
Jun 1, 2026
RepositoryMarkdown
DigitalPlatDev/FreeDomain

Free domain registration and practical DNS learning resources for everyone.

205.9k
Aug 12, 2026
RepositoryTypeScript
firecrawl/firecrawl

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

195.6k
Oct 26, 2026