Trying to understand crystal concurrency

Hi eatjason! Welcome to the forums.

Multithreading was released experimentally just a couple of minor versions ago. The Kemal example was written without mutlithreading in mind. Like Kemal, all existing programs might need to be reviewed to either use a mutex for shared data or communicate it using channels.

In the ws I can imagine the block runs in a separate fiber, and so SOCKETS must be synchronized with a mutex.

1 Like