or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing
xxxxxxxxxx
FUTURES CONCURRENCY III Reading notes
tags:
reading-club
https://blog.yoshuawuyts.com/futures-concurrency-3/
Leave notes below
(eholk) Are there ever cases where we want to blend the different concurrency modes?
In other words, are we sure we don't need/want the extra flexibility afforded by
select!
?Niko's blog post:
https://smallcultfollowing.com/babysteps/blog/2022/06/13/async-cancellation-a-case-study-of-pub-sub-in-mini-redis/#enter-select-our-dark-knight
nikomatsakis: what I want is something like a "token" where you both get an
&mut
but you share a single token that lets you do it. (language feature). You can't actually do this with locks unless the lock gets released on the awaitDeferred borrows - (eholk's review)
tmandry: Is this the right shape for the code we want to support?
nikomatsakis: You could use actors. This shape seems useful, but not sure.
"Anyone who uses an async lock probably should've used an actor instead" - because this pattern doesn't work well.
nikomatsakis: These tasks are conceptually related and happen to share state. Using actors would be to organize your code around the data.
Rust has strong support for spatial separation (different data) but relatively weak for temporal data (same data, different times).
tmandry: this is a pretty common rust thing, right? to organize around data?
nikomatsakis: yes. it is, and I do think that's part of what makes Rust reliable.
nikomatsakis: why does Rayon work? I guess because you just can't do this sort of thing, and because when you have locks you have the ability to release the lock when waiting.
I would like it if when you "open" these
&mut
…eholk: merge merge types, select does a better job interleaving streams of different types, but you can do it with an enum.
tmandry: anonymous enums could help
nikomatsakis: the problem I see is that anonymous enums, you have to match on what comes out? I guess if all the inputs are different types. the other thing i've thought about is some API that lets you build up the stream + the code to handle the stream (a closure), but
nikomatsakis: …or…maybe anonymous do work, if the match is that each arm has to have a distinct type.
Matching with closures in C++