Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5294db8

Browse files
authored
Merge pull request lewissbaker#103 from lofcek/master
Added links to README.md
2 parents d18e54a + 85dd7eb commit 5294db8

File tree

1 file changed

+65
-66
lines changed

1 file changed

+65
-66
lines changed

README.md

Lines changed: 65 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -4,50 +4,49 @@ The 'cppcoro' library provides a set of general-purpose primitives for making us
44

55
These include:
66
* Coroutine Types
7-
* `task<T>`
8-
* `shared_task<T>`
9-
* `generator<T>`
10-
* `recursive_generator<T>`
11-
* `async_generator<T>`
7+
* [`task<T>`](#taskt)
8+
* [`shared_task<T>`](#shared_taskt)
9+
* [`generator<T>`](#generatort)
10+
* [`recursive_generator<T>`](#recursive_generatort)
11+
* [`async_generator<T>`](#async_generatort)
1212
* Awaitable Types
13-
* `single_consumer_event`
14-
* `single_consumer_async_auto_reset_event`
15-
* `async_mutex`
16-
* `async_manual_reset_event`
17-
* `async_auto_reset_event`
18-
* `async_latch`
19-
* `sequence_barrier`
20-
* `multi_producer_sequencer`
21-
* `single_producer_sequencer`
13+
* [`single_consumer_event`](#single_consumer_event)
14+
* [`single_consumer_async_auto_reset_event`](#single_consumer_async_auto_reset_event)
15+
* [`async_mutex`](#async_mutex)
16+
* [`async_manual_reset_event`](#async_manual_reset_event)
17+
* [`async_auto_reset_event`](#async_auto_reset_event)
18+
* [`async_latch`](#async_latch)
19+
* [`sequence_barrier`](#sequence_barrier)
20+
* [`multi_producer_sequencer`](#multi_producer_sequencer)
21+
* [`single_producer_sequencer`](#single_producer_sequencer)
2222
* Functions
23-
* `sync_wait()`
24-
* `when_all()`
25-
* `when_all_ready()`
26-
* `fmap()`
27-
* `schedule_on()`
28-
* `resume_on()`
29-
* Cancellation
23+
* [`sync_wait()`](#sync_wait)
24+
* [`when_all()`](#when_all)
25+
* [`when_all_ready()`](#when_all_ready)
26+
* [`fmap()`](#fmap)
27+
* [`schedule_on()`](#schedule_on)
28+
* [`resume_on()`](#resume_on)
29+
* [Cancellation](#Cancellation)
3030
* `cancellation_token`
3131
* `cancellation_source`
3232
* `cancellation_registration`
3333
* Schedulers and I/O
34-
* `static_thread_pool`
35-
* `io_service`
36-
* `io_work_scope`
37-
* `file`, `readable_file`, `writable_file`
38-
* `read_only_file`, `write_only_file`, `read_write_file`
39-
Networking
40-
* `socket`
41-
* `ip_address`, `ipv4_address`, `ipv6_address`
42-
* `ip_endpoint`, `ipv4_endpoint`, `ipv6_endpoint`
34+
* [`static_thread_pool`](#static_thread_pool)
35+
* [`io_service` and `io_work_scope`](#io_service-and-io_work_scope)
36+
* [`file`, `readable_file`, `writable_file`](#file-readable_file-writable_file)
37+
* [`read_only_file`, `write_only_file`, `read_write_file`](#read_only_file-write_only_file-read_write_file)
38+
* Networking
39+
* [`socket`](#socket)
40+
* [`ip_address`, `ipv4_address`, `ipv6_address`](#ip_address-ipv4_address-ipv6_address)
41+
* [`ip_endpoint`, `ipv4_endpoint`, `ipv6_endpoint`](#ip_endpoint-ipv4_endpoint-ipv6_endpoint)
4342
* Metafunctions
44-
* `is_awaitable<T>`
45-
* `awaitable_traits<T>`
43+
* [`is_awaitable<T>`](#is_awaitablet)
44+
* [`awaitable_traits<T>`](#awaitable_traitst)
4645
* Concepts
47-
* `Awaitable<T>`
48-
* `Awaiter<T>`
49-
* `Scheduler`
50-
* `DelayedScheduler`
46+
* [`Awaitable<T>`](#Awaitablet-concept)
47+
* [`Awaiter<T>`](#Awaitert-concept)
48+
* [`Scheduler`](#Scheduler-concept)
49+
* [`DelayedScheduler`](#DelayedScheduler-concept)
5150

5251
This library is an experimental library that is exploring the space of high-performance,
5352
scalable asynchronous programming abstractions that can be built on top of the C++ coroutines
@@ -89,7 +88,7 @@ cppcoro::task<int> count_lines(std::string path)
8988
lineCount += std::count(buffer, buffer + bytesRead, '\n');
9089
offset += bytesRead;
9190
} while (bytesRead > 0);
92-
91+
9392
co_return lineCount;
9493
}
9594

@@ -98,9 +97,9 @@ cppcoro::task<> usage_example()
9897
// Calling function creates a new task but doesn't start
9998
// executing the coroutine yet.
10099
cppcoro::task<int> countTask = count_lines("foo.txt");
101-
100+
102101
// ...
103-
102+
104103
// Coroutine is only started when we later co_await the task.
105104
int lineCount = co_await countTask;
106105

@@ -146,10 +145,10 @@ namespace cppcoro
146145
// coroutine until the task completes.
147146
//
148147
// The 'co_await t.when_ready()' expression differs from 'co_await t' in
149-
// that when_ready() only performs synchronisation, it does not return
148+
// that when_ready() only performs synchronization, it does not return
150149
// the result or rethrow the exception.
151150
//
152-
// This can be useful if you want to synchronise with the task without
151+
// This can be useful if you want to synchronize with the task without
153152
// the possibility of it throwing an exception.
154153
Awaitable<void> when_ready() const noexcept;
155154
};
@@ -258,7 +257,7 @@ namespace cppcoro
258257
// is available.
259258
//
260259
// The result is not returned from the co_await expression.
261-
// This can be used to synchronise with the task without the
260+
// This can be used to synchronize with the task without the
262261
// possibility of the co_await expression throwing an exception.
263262
Awaiter<void> when_ready() const noexcept;
264263

@@ -281,7 +280,7 @@ namespace cppcoro
281280
}
282281
```
283282

284-
All const-methods on `shared_task<T>` are safe to call concurrently with other
283+
All const-methods on `shared_task<T>` are safe to call concurrently with other
285284
const-methods on the same instance from multiple threads. It is not safe to call
286285
non-const methods of `shared_task<T>` concurrently with any other method on the
287286
same instance of a `shared_task<T>`.
@@ -387,7 +386,7 @@ namespace cppcoro
387386

388387
generator(generator&& other) noexcept;
389388
generator& operator=(generator&& other) noexcept;
390-
389+
391390
generator(const generator& other) = delete;
392391
generator& operator=(const generator&) = delete;
393392

@@ -428,7 +427,7 @@ of the current coroutine will resume execution to produce the next element.
428427
429428
The benefit of `recursive_generator<T>` over `generator<T>` for iterating over recursive data-structures is that the `iterator::operator++()`
430429
is able to directly resume the leaf-most coroutine to produce the next element, rather than having to resume/suspend O(depth) coroutines for each element.
431-
The down-side is that there is additional overhead
430+
The down-side is that there is additional overhead
432431
433432
For example:
434433
```c++
@@ -499,7 +498,7 @@ namespace cppcoro
499498
using value_type = std::remove_reference_t<T>;
500499
using reference = value_type&;
501500
using pointer = value_type*;
502-
501+
503502
iterator(const iterator& other) noexcept;
504503
iterator& operator=(const iterator& other) noexcept;
505504
@@ -570,7 +569,7 @@ consumer coroutine is executing a `co_await` expression waiting for the next ite
570569

571570
This is a simple manual-reset event type that supports only a single
572571
coroutine awaiting it at a time.
573-
This can be used to
572+
This can be used to
574573

575574
API Summary:
576575
```c++
@@ -617,7 +616,7 @@ void producer()
617616

618617
## `single_consumer_async_auto_reset_event`
619618

620-
This class provides an async synchronisation primitive that allows a single coroutine to
619+
This class provides an async synchronization primitive that allows a single coroutine to
621620
wait until the event is signalled by a call to the `set()` method.
622621

623622
Once the coroutine that is awaiting the event is released by either a prior or subsequent call to `set()`
@@ -764,7 +763,7 @@ cppcoro::task<> add_item(std::string value)
764763

765764
## `async_manual_reset_event`
766765

767-
A manual-reset event is a coroutine/thread-synchronisation primitive that allows one or more threads
766+
A manual-reset event is a coroutine/thread-synchronization primitive that allows one or more threads
768767
to wait until the event is signalled by a thread that calls `set()`.
769768

770769
The event is in one of two states; *'set'* and *'not set'*.
@@ -845,7 +844,7 @@ namespace cppcoro
845844
846845
## `async_auto_reset_event`
847846
848-
An auto-reset event is a coroutine/thread-synchronisation primitive that allows one or more threads
847+
An auto-reset event is a coroutine/thread-synchronization primitive that allows one or more threads
849848
to wait until the event is signalled by a thread by calling `set()`.
850849
851850
Once a coroutine that is awaiting the event is released by either a prior or subsequent call to `set()`
@@ -914,7 +913,7 @@ namespace cppcoro
914913

915914
## `async_latch`
916915

917-
An async latch is a synchronisation primitive that allows coroutines to asynchronously
916+
An async latch is a synchronization primitive that allows coroutines to asynchronously
918917
wait until a counter has been decremented to zero.
919918

920919
The latch is a single-use object. Once the counter reaches zero the latch becomes 'ready'
@@ -954,7 +953,7 @@ namespace cppcoro
954953
955954
## `sequence_barrier`
956955
957-
A `sequence_barrier` is a synchronisation primitive that allows a single-producer
956+
A `sequence_barrier` is a synchronization primitive that allows a single-producer
958957
and multiple consumers to coordinate with respect to a monotonically increasing
959958
sequence number.
960959
@@ -985,7 +984,7 @@ namespace cppcoro
985984
986985
// Wait until the specified targetSequence number has been published.
987986
//
988-
// If the operation does not complete synchonously then the awaiting
987+
// If the operation does not complete synchronously then the awaiting
989988
// coroutine is resumed on the specified scheduler. Otherwise, the
990989
// coroutine continues without suspending.
991990
//
@@ -1003,7 +1002,7 @@ namespace cppcoro
10031002

10041003
## `single_producer_sequencer`
10051004

1006-
A `single_producer_sequencer` is a synchronisation primitived that can be used to
1005+
A `single_producer_sequencer` is a synchronization primitive that can be used to
10071006
coordinate access to a ring-buffer for a single producer and one or more consumers.
10081007

10091008
A producer first acquires one or more slots in a ring-buffer, writes to the ring-buffer
@@ -1053,7 +1052,7 @@ namespace cppcoro
10531052
SEQUENCE last_published() const noexcept;
10541053
10551054
template<typename SCHEDULER>
1056-
[[nodsicard]]
1055+
[[nodiscard]]
10571056
Awaitable<SEQUENCE> wait_until_published(
10581057
SEQUENCE targetSequence,
10591058
SCHEDULER& scheduler) const noexcept;
@@ -1091,7 +1090,7 @@ task<void> producer(
10911090
// Populate the message.
10921091
auto& msg = buffer[seq & indexMask];
10931092
msg.id = i;
1094-
msg.timestammp = steady_clock::now();
1093+
msg.timestamp = steady_clock::now();
10951094
msg.data = s;
10961095

10971096
// Publish the message.
@@ -1146,7 +1145,7 @@ task<void> example(io_service& ioSvc, static_thread_pool& threadPool)
11461145
11471146
## `multi_producer_sequencer`
11481147
1149-
The `multi_producer_sequencer` class is a synchronisation primitive that coordinates
1148+
The `multi_producer_sequencer` class is a synchronization primitive that coordinates
11501149
access to a ring-buffer for multiple producers and one or more consumers.
11511150
11521151
For a single-producer variant see the `single_producer_sequencer` class.
@@ -1208,7 +1207,7 @@ namespace cppcoro
12081207
}
12091208
```
12101209

1211-
## `cancellation_token`
1210+
## Cancellation
12121211

12131212
A `cancellation_token` is a value that can be passed to a function that allows the caller to subsequently communicate a request to cancel the operation to that function.
12141213

@@ -1399,7 +1398,7 @@ namespace cppcoro
13991398
14001399
// Return an operation that can be awaited by a coroutine.
14011400
//
1402-
//
1401+
//
14031402
[[nodiscard]]
14041403
schedule_operation schedule() noexcept;
14051404
@@ -1450,7 +1449,7 @@ cppcoro::task<double> dot_product(static_thread_pool& tp, double a[], double b[]
14501449
}
14511450
```
14521451

1453-
## `io_service`
1452+
## `io_service` and `io_work_scope`
14541453

14551454
The `io_service` class provides an abstraction for processing I/O completion events
14561455
from asynchronous I/O operations.
@@ -1654,7 +1653,7 @@ int main()
16541653

16551654
### `io_service` as a scheduler
16561655

1657-
An `io_sevice` class implements the interfaces for the `Scheduler` and `DelayedScheduler` concepts.
1656+
An `io_service` class implements the interfaces for the `Scheduler` and `DelayedScheduler` concepts.
16581657

16591658
This allows a coroutine to suspend execution on the current thread and schedule itself for resumption
16601659
on an I/O thread associated with a particular `io_service` object.
@@ -2045,7 +2044,7 @@ namespace cppcoro::net
20452044

20462045
constexpr const bytes_t& bytes() const;
20472046

2048-
cosntexpr std::uint32_t to_integer() const;
2047+
constexpr std::uint32_t to_integer() const;
20492048

20502049
static constexpr ipv4_address loopback();
20512050

@@ -2232,7 +2231,7 @@ namespace cppcoro::net
22322231

22332232
## `sync_wait()`
22342233

2235-
The `sync_wait()`function can be used to synchronously wait until the specified `awaitable`
2234+
The `sync_wait()` function can be used to synchronously wait until the specified `awaitable`
22362235
completes.
22372236

22382237
The specified awaitable will be `co_await`ed on current thread inside a newly created coroutine.
@@ -2242,7 +2241,7 @@ the `co_await` expression or rethrow the exception if the `co_await` expression
22422241
an unhandled exception.
22432242

22442243
The `sync_wait()` function is mostly useful for starting a top-level task from within `main()`
2245-
and waiting until the task finishes, in practise it is the only way to start the first/top-level
2244+
and waiting until the task finishes, in practice it is the only way to start the first/top-level
22462245
`task`.
22472246

22482247
API Summary:
@@ -2313,7 +2312,7 @@ The result of `co_await`ing the returned awaitable is a `std::tuple` or `std::ve
23132312
of `when_all_task<RESULT>` objects. These objects allow you to obtain the result (or exception)
23142313
of each input awaitable separately by calling the `when_all_task<RESULT>::result()`
23152314
method of the corresponding output task.
2316-
This allows the caller to concurrently await multiple awaitables and synchronise on
2315+
This allows the caller to concurrently await multiple awaitables and synchronize on
23172316
their completion while still retaining the ability to subsequently inspect the results of
23182317
each of the `co_await` operations for success/failure.
23192318

@@ -3081,7 +3080,7 @@ See below.
30813080

30823081
You can also use the bleeding-edge Clang version by building Clang from source yourself.
30833082

3084-
See instructions here:
3083+
See instructions here:
30853084

30863085
To do this you will need to install the following pre-requisites:
30873086
```

0 commit comments

Comments
 (0)