Recently I’ve been really interested in functional, concurrent programming languages, such as Erlang. This prompted me to have some fun in C, and try to implement a simple library that is based on the Actor Model.
Right now it is usable, although it may not be ready for production. It uses pthreads and the library handles all of the threading issues, so you don’t have to worry about any of it at all.
In a future version I plan to add more sandboxing to the actors, so that when one actor crashes, they don’t all go down!
Right now it supports the following:
- Spawn actor
- Sending messages
- Broadcast message
- Actor memory management convenience functions(when an actor dies, the memory is freed!)
Here is what a simple ping/pong example looks like:
There is a more detailed example in the source distribution, located in the examples/ directory.
You can get the source here. Please, let me know what you think about it, it was really fun to write!
Documentation is available here: http://chrismoos.com/libactordocs/