|
Ninja
|
A Jobserver::Slot models a single job slot that can be acquired from. More...
#include <jobserver.h>
Public Member Functions | |
| uint8_t | GetExplicitValue () const |
| Return value of an explicit slot. More... | |
| bool | IsExplicit () const |
| Return true if this instance represents an explicit job slot. More... | |
| bool | IsImplicit () const |
| Return true if this instance represents an implicit job slot. More... | |
| bool | IsValid () const |
| Return true if this instance is valid, i.e. More... | |
| Slot & | operator= (const Slot &)=delete |
| Slot & | operator= (Slot &&o) noexcept |
| Slot ()=default | |
| Default constructor creates invalid instance. More... | |
| Slot (const Slot &)=delete | |
| Copy operations are disallowed. More... | |
| Slot (Slot &&o) noexcept | |
| Move operations are allowed. More... | |
Static Public Member Functions | |
| static Slot | CreateExplicit (uint8_t value) |
| Create instance for explicit byte value. More... | |
| static Slot | CreateImplicit () |
| Create instance for the implicit value. More... | |
Private Member Functions | |
| Slot (int16_t value) | |
Private Attributes | |
| int16_t | value_ = -1 |
Static Private Attributes | |
| static constexpr int16_t | kImplicitValue = 256 |
A Jobserver::Slot models a single job slot that can be acquired from.
or released to a jobserver pool. This class is move-only, and can wrap three types of values:
Use IsValid(), IsImplicit(), HasValue() to test for categories.
TECHNICAL NOTE: This design complies with the requirements laid out on https://www.gnu.org/software/make/manual/html_node/POSIX-Jobserver.html which requires clients to write back the exact token values they received from a Posix pipe.
Note that currently all pool implementations write the same token values to the pipe ('+' for GNU Make, and '|' for the Rust jobserver), and do not care about the values written back by clients.
Definition at line 55 of file jobserver.h.
|
default |
Default constructor creates invalid instance.
Referenced by CreateExplicit(), and CreateImplicit().
|
inlinenoexcept |
Move operations are allowed.
Definition at line 60 of file jobserver.h.
|
delete |
Copy operations are disallowed.
|
inlineprivate |
Definition at line 97 of file jobserver.h.
|
inlinestatic |
Create instance for explicit byte value.
Definition at line 89 of file jobserver.h.
References Slot().
Referenced by TEST().
|
inlinestatic |
Create instance for the implicit value.
Definition at line 94 of file jobserver.h.
References kImplicitValue, and Slot().
Referenced by TEST().
| uint8_t Jobserver::Slot::GetExplicitValue | ( | ) | const |
Return value of an explicit slot.
It is a runtime error to call this from an invalid instance.
Definition at line 64 of file jobserver.cc.
References IsExplicit(), and value_.
Referenced by TEST().
|
inline |
Return true if this instance represents an explicit job slot.
Definition at line 82 of file jobserver.h.
References IsImplicit(), and IsValid().
Referenced by GetExplicitValue(), and TEST().
|
inline |
Return true if this instance represents an implicit job slot.
Definition at line 79 of file jobserver.h.
References kImplicitValue, and value_.
Referenced by IsExplicit(), and TEST().
|
inline |
Return true if this instance is valid, i.e.
that it is either implicit or explicit job slot.
Definition at line 76 of file jobserver.h.
References value_.
Referenced by Plan::FindWork(), IsExplicit(), and TEST().
Definition at line 62 of file jobserver.h.
References value_.
|
staticconstexprprivate |
Definition at line 99 of file jobserver.h.
Referenced by CreateImplicit(), and IsImplicit().
|
private |
Definition at line 101 of file jobserver.h.
Referenced by GetExplicitValue(), IsImplicit(), IsValid(), and operator=().