A coroutine-based multithreading library for Delphi enabling procedural-oriented programming with greenlets, channels, and async I/O.
AIO is a coroutine-based multithreading library for Delphi that implements procedural-oriented programming (POP) style. It allows developers to write concurrent code using lightweight state machines (greenlets) and communication channels, similar to GoLang, while abstracting away low-level threading and I/O complexities. The library provides high-level abstractions for CPU-efficient I/O operations across various OS hardware objects like TCP/UDP sockets, COM ports, named pipes, and files.
Delphi developers building scalable, concurrent applications such as telecommunication systems, multimedia delivery systems, or hardware interaction software. It is particularly useful for those who need to manage active entities like sockets and devices in a readable, testable manner.
Developers choose AIO over alternatives because it combines the advantages of OOP and POP, enabling block-style coding for non-blocking I/O without platform-specific API calls. Its unique selling point is the integration of Go-like channels and greenlets for seamless data sharing and scheduling, making concurrent Delphi code more manageable and efficient.
Coroutine-based multithreading library for Delphi
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
AIO providers abstract platform-specific non-blocking APIs for TCP/UDP sockets, COM ports, and files, allowing developers to write block-style code without manual synchronization, as shown in the demos for HTTP clients and named pipes.
Implements greenlets and communication channels similar to GoLang, enabling readable data sharing between state machines without semaphores or mutexes, with sync and async channels for flexible data transfer.
Greenlets can be explicitly scheduled to specific threads or pools using TGreenThread, or implicitly with BeginThread/EndThread, optimizing CPU-intensive tasks like Fibonacci calculations across threads.
Allows combining procedural-oriented programming with existing Delphi OOP frameworks, using records for greenlets to avoid platform-specific ARC issues while maintaining compatibility.
Currently supports only Windows, with cross-platform support listed as a future feature in the README, which restricts its use in multi-OS Delphi projects.
Requires monkey patching or rewriting message loops for GUI applications, adding an extra layer of complexity for VCL or FMX integration, as demonstrated in the MonkeyPatching demo.
The README has several 'TODO' sections in HowTo guides and technical references, indicating gaps in tutorials that could slow down learning and adoption.