@@ -4,7 +4,7 @@ This module provides a lightweight stackful fiber implementation including a
4
4
simple round-robin scheduler. Here is a minimal example that blinks an LED:
5
5
6
6
``` cpp
7
- modm::Fiber<> fiber ([ ]
7
+ modm::Fiber fiber ([ ]
8
8
{
9
9
Board::LedBlue::setOutput();
10
10
while(true)
@@ -25,9 +25,9 @@ int main()
25
25
You can construct a fiber from any function without return type or arguments:
26
26
27
27
```cpp
28
- modm::Fiber<> fiber([]{});
28
+ modm::Fiber fiber([]{});
29
29
void function() {}
30
- modm::Fiber<> fiber2(function);
30
+ modm::Fiber fiber2(function);
31
31
```
32
32
33
33
To call objects with arguments, wrap the data into a lambda closure and
@@ -40,7 +40,7 @@ struct DataObject
40
40
void member_function(int arg);
41
41
} object;
42
42
int number{42};
43
- modm::Fiber<> fiber([ &]
43
+ modm::Fiber fiber([ &]
44
44
{
45
45
object.member_function(number);
46
46
});
@@ -52,7 +52,7 @@ capture, or construct them in the capture directly, if they would get destroyed
52
52
after fiber construction. You may need to mark the lambda mutable:
53
53
54
54
```cpp
55
- modm::Fiber<> fiber2([obj=std::move(object), obj2=DataObject()] mutable
55
+ modm::Fiber fiber2([obj=std::move(object), obj2=DataObject()] mutable
56
56
{
57
57
obj.member_function(24);
58
58
obj2.member_function(42);
@@ -68,7 +68,7 @@ A fiber can be passed a `modm::fiber::stop_token` to allow the fiber to be
68
68
stopped cooperatively.
69
69
70
70
``` cpp
71
- modm::Fiber<> fiber ([ ] (modm::fiber::stop_token stoken)
71
+ modm::Fiber fiber ([ ] (modm::fiber::stop_token stoken)
72
72
{
73
73
// set up
74
74
while(not stoken.stop_requested())
@@ -96,9 +96,9 @@ when it is ready, also from another fiber:
96
96
97
97
```cpp
98
98
// fiber does not automatically start executing
99
- modm::Fiber<> fiber2(function, modm::fiber::Start::Later);
99
+ modm::Fiber fiber2(function, modm::fiber::Start::Later);
100
100
// fiber2 is automatically executing
101
- modm::Fiber<> fiber1([&]
101
+ modm::Fiber fiber1([&]
102
102
{
103
103
modm::this_fiber::sleep_for(1s);
104
104
fiber2.start();
@@ -115,7 +115,7 @@ restarts. If you need a fiber that is only callable once, you can implement this
115
115
behavior manually with a boolean in the capture:
116
116
117
117
``` cpp
118
- modm::Fiber<> fiber ([ ran=false]
118
+ modm::Fiber fiber ([ ran=false]
119
119
{
120
120
if (ran) return;
121
121
ran = true;
@@ -139,7 +139,7 @@ the fibers into the `.faststack` section, which is not zeroed and thus saves a
139
139
bit of time on startup:
140
140
141
141
``` cpp
142
- modm_faststack modm::Fiber<> (stack, function);
142
+ modm_faststack modm::Fiber (stack, function);
143
143
```
144
144
145
145
However, it may be desirable to control the placement of the fiber task
@@ -380,9 +380,9 @@ and task into the core-affine memory:
380
380
381
381
``` cpp
382
382
// allocate into core0 memory
383
- modm_faststack_core0 modm::Fiber<> fiber0 (function);
383
+ modm_faststack_core0 modm::Fiber fiber0 (function);
384
384
// allocate into core1 memory but DO NOT start yet!
385
- modm_faststack_core1 modm::Fiber<> fiber1(function, modm::fiber::Start::Later);
385
+ modm_faststack_core1 modm::Fiber fiber1(function, modm::fiber::Start::Later);
386
386
387
387
void core1_main()
388
388
{
0 commit comments