Comments (6)
Heya @amirouche... I'm not sure this belongs on the bug tracker, so I'm going to close it (maybe in the future guile-user is a better place to discuss this?), but it it's a good question.
The right route is to never use locks directly. Instead, you have two patterns:
- if there's a resource that can only be controlled by a single process at a time, set up a single fiber to handle that and read in "requests". If you also need to supply a response you can accept as an argument a "response channel" and then reply on that once you're done. Then that fiber just loops forever reading messages in and performing actions.
- If there's a resource that can have multiple processes operating on it, but only a finite amount of them, set up a "process pool" to work on it... have a manager process receive the requests and then farm out to a fixed pool of "worker processes", otherwise following the same process as above!
Hope that helps... does that make sense to you?
from fibers.
That's what I had in mind, but I did not come up with the code yet.
from fibers.
btw, everybody on github use issues to ask questions.
from fibers.
That said, I will ask my questions in the mailling list in the future. I feared that my question would go without notice on the ML ...
from fibers.
Yeah I understand... it also sometimes makes sense to ask because maybe it wasn't a feature that Fibers provided.
Maybe what we need is a "common patterns" page so that people can see how to do these kinds of things?
from fibers.
Yes.
from fibers.
Related Issues (20)
- Possibly wrong usage of atomic-box-set!
- Lots of unmerged pull reqs!? HOT 4
- Unknown meta command: fibers HOT 2
- In procedure pipe: Too many open files HOT 6
- Infinite loops on uncaught exceptions HOT 5
- Guix build guile-fibers test fails: Too many heap sections. HOT 2
- epoll instance is dead HOT 6
- fibers does not build without epoll HOT 4
- Memory leak on context switches HOT 9
- fibers.scm uses deprecated bitvector-set! HOT 7
- README.md doesn't document dependencies
- fibers depends on gnulib HOT 1
- configure.ac has two operating systems hard-coded, posix-clocks-foo.scm related? HOT 4
- `race-until` test runs forever (1.2.0 + affinity patch, NetBSD 9 amd64) HOT 1
- Cannot print backtraces within a fiber HOT 13
- [doc] clarify the use of dynamic-wind, probably in the Barriers chapter HOT 1
- Guile deprecation warning due to bit-count HOT 9
- Fibers wait can forever on a file descriptor once it has been closed HOT 1
- 'get-message' continuation fired more than once? HOT 13
- On GNU/Hurd, 'time_units_per_microsec' is zero HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fibers.