mdbergmann / cl-gserver

Sento - Actor framework featuring actors and agents for easy access to state and asynchronous operations.

Home Page:https://mdbergmann.github.io/cl-gserver/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make container that holds actor instances in actor-context thread-safe

mdbergmann opened this issue · comments

Well, it is kind of thread-safe via modifying and swapping the list instance.
But actor instances could get lost when actors are added/removed from multiple-threads.

This should be supported by some CAS mechanism.

Did some research in regards to CAS vs. locking.
It seems that CAS is still on average more performant than locking because locking requires task changes that involve saving and restoring registers, etc.
CAS may use more CPU as the thread just tries until there is no more change.

Implemented CAS for references for ABCL as it is not supported in atomics package.

I'm not super happy with the code because now some #-abcl | #+abcl is in actor-context where there should be a container 'primitive' supporting multi-threading. That's what I'll still do as a refactoring.
But the code works.

Did some refactorings and made abstractions to have #+-abcl only in the ASDF system definition.