Skip to content

Commit 744a83b

Browse files
committed
core docs looking good
1 parent c866b84 commit 744a83b

File tree

16 files changed

+216
-160
lines changed

16 files changed

+216
-160
lines changed

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ target_compile_features(libfork_libfork INTERFACE cxx_std_23)
4040

4141
# ---- Compiler options ----- #
4242

43-
option(LF_FIBRE_STACK_SIZE "The size of the fibre stack (in multiples 4kb pages)" OFF)
43+
option(LF_FIBRE_INIT_SIZE "The initial size (bytes) of a fibre's stack (default 4 KiB)" OFF)
4444

45-
if(LF_FIBRE_STACK_SIZE)
46-
target_compile_definitions(libfork_libfork INTERFACE LF_FIBRE_STACK_SIZE=${LF_FIBRE_STACK_SIZE})
45+
if(LF_FIBRE_INIT_SIZE)
46+
target_compile_definitions(libfork_libfork INTERFACE LF_FIBRE_INIT_SIZE=${LF_FIBRE_INIT_SIZE})
4747
endif()
4848

4949
# If this is off then libfork will store a pointer to avoid any UB, enable only as an optimization

TODO.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
- Check HWLOC numa detection is up to par
44

5-
- Make LF_FIBER_STACK_SIZE set init fibre size instead of current
6-
75
- Benchmarks working, run benchmarks on CSD3 with mimalloc
86

97
- Fix github actions

docs/api/core.gen.rst

Lines changed: 0 additions & 8 deletions
This file was deleted.

docs/api/core.rst

Lines changed: 58 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,41 @@
11
Core API
22
===================
33

4-
The ``core`` namespace contains the basic building blocks of the library.
5-
To include all of ``core`` use ``#include <libfork/core.hpp>``.
4+
The ``core`` subfolder/namespace contains the basic building blocks of the library, this is the API to describe DAG's and internal/backend machinery for memory management. To include just libfork's core use ``#include <libfork/core.hpp>``.
65

7-
Control flow
8-
--------------------------------
6+
Enums
7+
-----
98

10-
These function-like objects are used to control the flow of execution while building a directed acyclic task graph.
9+
.. doxygenenum:: lf::core::tag
1110

12-
.. doxygenfunction:: lf::core::sync_wait
11+
Concepts and traits
12+
-----------------------------
1313

14-
.. doxygenvariable:: lf::core::fork
14+
Libfork has a concept-driven API, built upon the following concepts.
1515

16-
.. doxygenvariable:: lf::core::call
17-
18-
.. doxygenvariable:: lf::core::join
19-
20-
21-
Concepts
22-
------------
23-
24-
.. doxygenconcept:: lf::core::scheduler
16+
Building blocks
17+
~~~~~~~~~~~~~~~
2518

2619
.. doxygenconcept:: lf::core::returnable
2720

2821
.. doxygenconcept:: lf::core::dereferenceable
2922

3023
.. doxygenconcept:: lf::core::quasi_pointer
3124

25+
API
26+
~~~
27+
3228
.. doxygenconcept:: lf::core::async_function_object
3329

3430
.. doxygenconcept:: lf::core::first_arg
3531

32+
.. doxygenconcept:: lf::core::scheduler
33+
34+
.. doxygenconcept:: lf::core::co_allocable
35+
36+
Functional
37+
~~~~~~~~~~
38+
3639
.. doxygenconcept:: lf::core::async_invocable
3740

3841
.. doxygenconcept:: lf::core::invocable
@@ -41,51 +44,64 @@ Concepts
4144

4245
.. doxygenconcept:: lf::core::forkable
4346

44-
.. doxygenconcept:: lf::core::co_allocable
47+
Utility
48+
.......
4549

50+
.. doxygentypedef:: async_result_t
4651

47-
Other
48-
----------------
4952

50-
.. doxygenclass:: lf::core::defer
51-
:members:
52-
:undoc-members:
53+
Control flow
54+
--------------------------------
5355

54-
.. doxygentypedef:: async_result_t
56+
.. doxygenfunction:: lf::core::sync_wait
5557

56-
Classes
57-
------------
58+
Fork-join
59+
~~~~~~~~~~~~
5860

59-
.. toctree::
60-
:glob:
61-
:maxdepth: 2
61+
.. doxygenvariable:: lf::core::fork
6262

63-
core/task.rst
64-
core/eventually.rst
63+
.. doxygenvariable:: lf::core::call
6564

66-
Stack allocation
67-
------------------
65+
.. doxygenvariable:: lf::core::join
6866

69-
.. doxygenfunction:: lf::core::co_new()
7067

71-
.. doxygenfunction:: lf::core::co_new(std::size_t count)
68+
Classes
69+
----------------
7270

73-
.. doxygenfunction:: lf::core::co_delete(T *ptr)
71+
Task
72+
~~~~
7473

75-
.. doxygenfunction:: lf::core::co_delete(std::span<T, Extent> span)
74+
.. doxygenstruct:: lf::core::task
75+
:members:
76+
:undoc-members:
77+
78+
Eventually
79+
~~~~~~~~~~
7680

77-
Generated listing
78-
---------------------
81+
.. doxygenclass:: lf::core::eventually
82+
:members:
83+
:undoc-members:
7984

80-
.. toctree::
81-
core.gen.rst
8285

86+
.. doxygenclass:: lf::core::manual_eventually
87+
:members:
88+
:undoc-members:
8389

90+
Defer
91+
~~~~~
8492

93+
.. doxygenclass:: lf::core::defer
94+
:members:
95+
:undoc-members:
8596

8697

87-
98+
Stack allocation
99+
------------------
100+
101+
.. doxygenfunction:: lf::core::co_new()
88102

103+
.. doxygenfunction:: lf::core::co_new(std::size_t count)
89104

105+
.. doxygenfunction:: lf::core::co_delete(T *ptr)
90106

91-
107+
.. doxygenfunction:: lf::core::co_delete(std::span<T, Extent> span)

docs/api/core/eventually.rst

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/api/core/task.rst

Lines changed: 0 additions & 6 deletions
This file was deleted.

include/libfork/core/co_alloc.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ inline namespace core {
2929

3030
/**
3131
* @brief Check is a type is suitable for allocation on libfork's stacks.
32+
*
33+
* This requires the type to be `std::default_initializable<T>` and have non-new-extended alignment.
3234
*/
3335
template <typename T>
3436
concept co_allocable = std::default_initializable<T> && alignof(T) <= impl::k_new_align;

include/libfork/core/eventually.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ class eventually<T> : impl::immovable<eventually<T>> {
130130
// ------------------------------------------------------------------------ //
131131

132132
/**
133-
* @brief A `manual_eventually<T>` is an `eventually<T>` which does not call destroy on destruction.
133+
* @brief A `lf::manual_eventually<T>` is an `lf::eventually<T>` which does not call destroy on destruction.
134134
*
135135
* This is useful for writing exception safe fork-join code and should be considered an expert-only feature.
136136
*/

include/libfork/core/first_arg.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ concept quasi_pointer = std::default_initializable<I> && std::movable<I> && dere
5353
* object](https://en.cppreference.com/w/cpp/named_req/FunctionObject).
5454
*
5555
* An async function object is a function object that returns an `lf::task` when `operator()` is called.
56-
* with appropriate arguments. The call to `operator()` must create a coroutine. The first argument
57-
* of an async function must accept a deduced templated type that satisfies the `lf::core::first_arg` concept.
56+
* with appropriate arguments. The call to `operator()` must create a libfork coroutine. The first argument
57+
* of an async function must accept a deduced templated-type that satisfies the `lf::core::first_arg` concept.
5858
* The return type and invocability of an async function must be independent of the first argument except
5959
* for its tag value.
6060
*
@@ -68,7 +68,10 @@ concept async_function_object = std::is_object_v<F> && std::copy_constructible<F
6868
/**
6969
* @brief This describes the public-API of the first argument passed to an async function.
7070
*
71-
* An async functions' invocability and return type must be independent of their first argument.
71+
* An async functions' invocability and return type must be independent of their first argument except for its
72+
* tag value. A user may query the first argument's static member `tag` to obtain this value. Additionally, a
73+
* user may query the first argument's static member function `context()` to obtain a pointer to the current
74+
* workers `lf::context`.
7275
*/
7376
template <typename T>
7477
concept first_arg = async_function_object<T> && requires (T arg) {

include/libfork/core/impl/manual_lifetime.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class manual_lifetime : immovable<manual_lifetime<T>> {
4242
}
4343

4444
/**
45-
* @brief Start lifetime of object.
45+
* @brief Start lifetime of object at assignment.
4646
*/
4747
template <typename U>
4848
requires std::constructible_from<T, U>

0 commit comments

Comments
 (0)