Skip to content

Thread version (ie. no async code) for gen_server#5

Merged
ElFantasma merged 19 commits intomainfrom
no_async_handlers
May 29, 2025
Merged

Thread version (ie. no async code) for gen_server#5
ElFantasma merged 19 commits intomainfrom
no_async_handlers

Conversation

@ElFantasma
Copy link
Copy Markdown
Collaborator

@ElFantasma ElFantasma commented May 20, 2025

Initial POC for a OS threaded version of gen_server, instead of using async/await model.

  • Both models coexists, and all examples are duplicated to run on both versions.
  • Only a module switch and some minor modifications (eg. remove async and await declarations) are required to support one model or the other.

Pending improvements (probably implemented in future tickets):

  • Not sure about modules naming: async/sync are not correct names for both versions, maybe they should be something like thread/task models.... Suggestions are welcome
    Edit: Already renamed to threads/tasks as they are more explicit.
  • OS Threads should be provided from a pool instead of spawning freely on demand
  • Runtime creation to run async code within threaded model should be centralized and reused in case it's required more than once.
  • Possibly hide both implementation under feature flags, to enable/disable each one

@ElFantasma ElFantasma merged commit ded9a1f into main May 29, 2025
@juan518munoz juan518munoz deleted the no_async_handlers branch July 18, 2025 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants