Comments (5)
@Yevgnen, great question! I'm glad you asked because it turns out it's actually not needed since flume::Sender
is Sync
(https://docs.rs/flume/latest/flume/struct.Sender.html#impl-Sync). #22 will remove the Mutex
.
from batched-fn.
Hi @liebkne! See https://docs.rs/batched-fn/latest/batched_fn/#implementation-details, in particular:
When the
batched_fn
macro is invoked it spawns a new thread where the handler will be ran. Within that thread, every object specified in the context is initialized and then passed by reference to the handler each time it is run.
All three arguments (handler
, config
, and context
) are required, and yes, the code inside context
is only run once for initialization.
I hope that answers your question! I haven't used actix
recently, but if you do get an example working I'd be happy to share it in this repo.
from batched-fn.
That's great help! Thank you very much! Following you hints, I spent some time to understand the macro and I think I've understood 90% of it. 😂
I will try to make a working example and once I did I will make a PR.
from batched-fn.
Great! Looking forward to it 🙂
from batched-fn.
I'm also pretty new to Rust and async things and found a tutorial from tokio-channel. After I read the source code I found the pattern (using channels) of the library is similar.
@epwalsh May I ask a question? Why Mutex
is needed in BatchedFn
?
from batched-fn.
Related Issues (6)
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 batched-fn.