Displaying 3 results from an estimated 3 matches for "co_await".
2020 Nov 18
0
[RFC] Coroutine and pthread_self
...ate and hence always return the same
result. Hence in the following code:
auto x1 = pthread_self();
...
auto x2 = pthread_self();
the second call to pthread_self() can be optimized out. This has been
correct until coroutines. With coroutines, we can have code like this:
auto x1 = pthread_self();
co_await ...
auto x2 = pthread_self();
Now because of the co_await, the function can suspend and resume in a
different thread, in which case the second call to pthread_self()
should return a different result than the first one. Unfortunately
LLVM will still optimize out the second call in the case of
corou...
2020 Feb 06
2
Why is lldb telling me "variable not available"?
...vior on lines 23-40 of the C++ program,
https://gist.github.com/modocache/670bc38e5a5ea2e0a3d6bafe8ea9c693#file-test-cpp-L23-L40,
which I’ll paste below:
```
coro foo() {
int i = 0;
++i;
printf("%d\n", i); // 1
// Breakpoint 1:
// (lldb) frame variable i
// (int) i = 1
co_await suspend_always();
int j = 0;
++i;
++j;
printf("%d, %d\n", i, j); // 2, 1
// Breakpoint 2:
// (lldb) frame variable i
// (int) i = <variable not available>
// (lldb) frame variable j
// (int) j = 1
```
Here 'foo' is a coroutine, and the comments den...
2016 Jun 09
6
Fwd: [RFC] LLVM Coroutines
Hi all:
Below is a proposal to add experimental coroutine support to LLVM. Though this
proposal is motivated primarily by the desire to support C++ Coroutines [1],
the llvm representation is language neutral and can be used to support
coroutines in other languages as well.
Clang + llvm coroutines allows you to take this code:
generator<int> range(int from, int to) {
for(int i =