Commit 168cb630 authored by Kenton Varda's avatar Kenton Varda

Remame Guarded -> Bounded.

parent c534e8b6
......@@ -45,7 +45,7 @@ kj::Own<ClientHook> AnyPointer::Reader::getPipelinedCap(
break;
case PipelineOp::Type::GET_POINTER_FIELD:
pointer = pointer.getStruct(nullptr).getPointerField(guarded(op.pointerIndex) * POINTERS);
pointer = pointer.getStruct(nullptr).getPointerField(bounded(op.pointerIndex) * POINTERS);
break;
}
}
......
......@@ -398,10 +398,10 @@ struct List<AnyPointer, Kind::OTHER> {
inline Reader(): reader(ElementSize::POINTER) {}
inline explicit Reader(_::ListReader reader): reader(reader) {}
inline uint size() const { return unguard(reader.size() / ELEMENTS); }
inline uint size() const { return unbound(reader.size() / ELEMENTS); }
inline AnyPointer::Reader operator[](uint index) const {
KJ_IREQUIRE(index < size());
return AnyPointer::Reader(reader.getPointerElement(guarded(index) * ELEMENTS));
return AnyPointer::Reader(reader.getPointerElement(bounded(index) * ELEMENTS));
}
typedef _::IndexingIterator<const Reader, typename AnyPointer::Reader> Iterator;
......@@ -430,10 +430,10 @@ struct List<AnyPointer, Kind::OTHER> {
inline operator Reader() const { return Reader(builder.asReader()); }
inline Reader asReader() const { return Reader(builder.asReader()); }
inline uint size() const { return unguard(builder.size() / ELEMENTS); }
inline uint size() const { return unbound(builder.size() / ELEMENTS); }
inline AnyPointer::Builder operator[](uint index) {
KJ_IREQUIRE(index < size());
return AnyPointer::Builder(builder.getPointerElement(guarded(index) * ELEMENTS));
return AnyPointer::Builder(builder.getPointerElement(bounded(index) * ELEMENTS));
}
typedef _::IndexingIterator<Builder, typename AnyPointer::Builder> Iterator;
......@@ -563,10 +563,10 @@ public:
inline Reader(): reader(ElementSize::INLINE_COMPOSITE) {}
inline explicit Reader(_::ListReader reader): reader(reader) {}
inline uint size() const { return unguard(reader.size() / ELEMENTS); }
inline uint size() const { return unbound(reader.size() / ELEMENTS); }
inline AnyStruct::Reader operator[](uint index) const {
KJ_IREQUIRE(index < size());
return AnyStruct::Reader(reader.getStructElement(guarded(index) * ELEMENTS));
return AnyStruct::Reader(reader.getStructElement(bounded(index) * ELEMENTS));
}
typedef _::IndexingIterator<const Reader, typename AnyStruct::Reader> Iterator;
......@@ -595,10 +595,10 @@ public:
inline operator Reader() const { return Reader(builder.asReader()); }
inline Reader asReader() const { return Reader(builder.asReader()); }
inline uint size() const { return unguard(builder.size() / ELEMENTS); }
inline uint size() const { return unbound(builder.size() / ELEMENTS); }
inline AnyStruct::Builder operator[](uint index) {
KJ_IREQUIRE(index < size());
return AnyStruct::Builder(builder.getStructElement(guarded(index) * ELEMENTS));
return AnyStruct::Builder(builder.getStructElement(bounded(index) * ELEMENTS));
}
typedef _::IndexingIterator<Builder, typename AnyStruct::Builder> Iterator;
......@@ -628,7 +628,7 @@ public:
#endif
inline ElementSize getElementSize() { return _reader.getElementSize(); }
inline uint size() { return unguard(_reader.size() / ELEMENTS); }
inline uint size() { return unbound(_reader.size() / ELEMENTS); }
inline kj::ArrayPtr<const byte> getRawBytes() { return _reader.asRawBytes(); }
......@@ -664,7 +664,7 @@ public:
#endif
inline ElementSize getElementSize() { return _builder.getElementSize(); }
inline uint size() { return unguard(_builder.size() / ELEMENTS); }
inline uint size() { return unbound(_builder.size() / ELEMENTS); }
Equality equals(AnyList::Reader right);
inline bool operator==(AnyList::Reader right) {
......@@ -781,21 +781,21 @@ inline BuilderFor<T> AnyPointer::Builder::initAs(uint elementCount) {
inline AnyList::Builder AnyPointer::Builder::initAsAnyList(
ElementSize elementSize, uint elementCount) {
return AnyList::Builder(builder.initList(elementSize, guarded(elementCount) * ELEMENTS));
return AnyList::Builder(builder.initList(elementSize, bounded(elementCount) * ELEMENTS));
}
inline List<AnyStruct>::Builder AnyPointer::Builder::initAsListOfAnyStruct(
uint16_t dataWordCount, uint16_t pointerCount, uint elementCount) {
return List<AnyStruct>::Builder(builder.initStructList(guarded(elementCount) * ELEMENTS,
_::StructSize(guarded(dataWordCount) * WORDS,
guarded(pointerCount) * POINTERS)));
return List<AnyStruct>::Builder(builder.initStructList(bounded(elementCount) * ELEMENTS,
_::StructSize(bounded(dataWordCount) * WORDS,
bounded(pointerCount) * POINTERS)));
}
inline AnyStruct::Builder AnyPointer::Builder::initAsAnyStruct(
uint16_t dataWordCount, uint16_t pointerCount) {
return AnyStruct::Builder(builder.initStruct(
_::StructSize(guarded(dataWordCount) * WORDS,
guarded(pointerCount) * POINTERS)));
_::StructSize(bounded(dataWordCount) * WORDS,
bounded(pointerCount) * POINTERS)));
}
template <typename T>
......@@ -971,8 +971,8 @@ struct PointerHelpers<AnyStruct, Kind::OTHER> {
static inline AnyStruct::Builder init(
PointerBuilder builder, uint16_t dataWordCount, uint16_t pointerCount) {
return AnyStruct::Builder(builder.initStruct(
StructSize(guarded(dataWordCount) * WORDS,
guarded(pointerCount) * POINTERS)));
StructSize(bounded(dataWordCount) * WORDS,
bounded(pointerCount) * POINTERS)));
}
// TODO(soon): implement these
......@@ -996,14 +996,14 @@ struct PointerHelpers<AnyList, Kind::OTHER> {
static inline AnyList::Builder init(
PointerBuilder builder, ElementSize elementSize, uint elementCount) {
return AnyList::Builder(builder.initList(
elementSize, guarded(elementCount) * ELEMENTS));
elementSize, bounded(elementCount) * ELEMENTS));
}
static inline AnyList::Builder init(
PointerBuilder builder, uint16_t dataWordCount, uint16_t pointerCount, uint elementCount) {
return AnyList::Builder(builder.initStructList(
guarded(elementCount) * ELEMENTS,
StructSize(guarded(dataWordCount) * WORDS,
guarded(pointerCount) * POINTERS)));
bounded(elementCount) * ELEMENTS,
StructSize(bounded(dataWordCount) * WORDS,
bounded(pointerCount) * POINTERS)));
}
// TODO(soon): implement these
......
......@@ -42,7 +42,7 @@ void ReadLimiter::unread(WordCount64 amount) {
// the limit value was not updated correctly for one or more reads, and therefore unread() could
// overflow it even if it is only unreading bytes that were actually read.
uint64_t oldValue = limit;
uint64_t newValue = oldValue + unguard(amount / WORDS);
uint64_t newValue = oldValue + unbound(amount / WORDS);
if (newValue > oldValue) {
limit = newValue;
}
......@@ -58,7 +58,7 @@ void SegmentBuilder::throwNotWritable() {
// =======================================================================================
static SegmentWordCount verifySegmentSize(size_t size) {
auto gsize = guarded(size) * WORDS;
auto gsize = bounded(size) * WORDS;
return assertMaxBits<SEGMENT_WORD_COUNT_BITS>(gsize, [&]() {
KJ_FAIL_REQUIRE("segment is too large", size);
});
......@@ -67,7 +67,7 @@ static SegmentWordCount verifySegmentSize(size_t size) {
inline ReaderArena::ReaderArena(MessageReader* message, const word* firstSegment,
SegmentWordCount firstSegmentSize)
: message(message),
readLimiter(guarded(message->getOptions().traversalLimitInWords) * WORDS),
readLimiter(bounded(message->getOptions().traversalLimitInWords) * WORDS),
segment0(this, SegmentId(0), firstSegment, firstSegmentSize, &readLimiter) {}
inline ReaderArena::ReaderArena(MessageReader* message, kj::ArrayPtr<const word> firstSegment)
......@@ -178,7 +178,7 @@ SegmentBuilder* BuilderArena::getSegment(SegmentId id) {
BuilderArena::AllocateResult BuilderArena::allocate(SegmentWordCount amount) {
if (segment0.getArena() == nullptr) {
// We're allocating the first segment.
kj::ArrayPtr<word> ptr = message->allocateSegment(unguard(amount / WORDS));
kj::ArrayPtr<word> ptr = message->allocateSegment(unbound(amount / WORDS));
auto actualSize = verifySegmentSize(ptr.size());
// Re-allocate segment0 in-place. This is a bit of a hack, but we have not returned any
......@@ -204,7 +204,7 @@ BuilderArena::AllocateResult BuilderArena::allocate(SegmentWordCount amount) {
}
// Need to allocate a new segment.
SegmentBuilder* result = addSegmentInternal(message->allocateSegment(unguard(amount / WORDS)));
SegmentBuilder* result = addSegmentInternal(message->allocateSegment(unbound(amount / WORDS)));
// Check this new segment first the next time we need to allocate.
segmentWithSpace = result;
......
......@@ -342,19 +342,19 @@ private:
inline ReadLimiter::ReadLimiter()
: limit(kj::maxValue) {}
inline ReadLimiter::ReadLimiter(WordCount64 limit): limit(unguard(limit / WORDS)) {}
inline ReadLimiter::ReadLimiter(WordCount64 limit): limit(unbound(limit / WORDS)) {}
inline void ReadLimiter::reset(WordCount64 limit) { this->limit = unguard(limit / WORDS); }
inline void ReadLimiter::reset(WordCount64 limit) { this->limit = unbound(limit / WORDS); }
inline bool ReadLimiter::canRead(WordCount64 amount, Arena* arena) {
// Be careful not to store an underflowed value into `limit`, even if multiple threads are
// decrementing it.
uint64_t current = limit;
if (KJ_UNLIKELY(unguard(amount / WORDS) > current)) {
if (KJ_UNLIKELY(unbound(amount / WORDS) > current)) {
arena->reportReadLimitReached();
return false;
} else {
limit = current - unguard(amount / WORDS);
limit = current - unbound(amount / WORDS);
return true;
}
}
......@@ -363,7 +363,7 @@ inline bool ReadLimiter::canRead(WordCount64 amount, Arena* arena) {
inline SegmentReader::SegmentReader(Arena* arena, SegmentId id, const word* ptr,
SegmentWordCount size, ReadLimiter* readLimiter)
: arena(arena), id(id), ptr(kj::arrayPtr(ptr, unguard(size / WORDS))),
: arena(arena), id(id), ptr(kj::arrayPtr(ptr, unbound(size / WORDS))),
readLimiter(readLimiter) {}
inline bool SegmentReader::containsInterval(const void* from, const void* to) {
......
......@@ -650,11 +650,11 @@ struct List<T, Kind::INTERFACE> {
Reader() = default;
inline explicit Reader(_::ListReader reader): reader(reader) {}
inline uint size() const { return unguard(reader.size() / ELEMENTS); }
inline uint size() const { return unbound(reader.size() / ELEMENTS); }
inline typename T::Client operator[](uint index) const {
KJ_IREQUIRE(index < size());
return typename T::Client(reader.getPointerElement(
guarded(index) * ELEMENTS).getCapability());
bounded(index) * ELEMENTS).getCapability());
}
typedef _::IndexingIterator<const Reader, typename T::Client> Iterator;
......@@ -683,23 +683,23 @@ struct List<T, Kind::INTERFACE> {
inline operator Reader() const { return Reader(builder.asReader()); }
inline Reader asReader() const { return Reader(builder.asReader()); }
inline uint size() const { return unguard(builder.size() / ELEMENTS); }
inline uint size() const { return unbound(builder.size() / ELEMENTS); }
inline typename T::Client operator[](uint index) {
KJ_IREQUIRE(index < size());
return typename T::Client(builder.getPointerElement(
guarded(index) * ELEMENTS).getCapability());
bounded(index) * ELEMENTS).getCapability());
}
inline void set(uint index, typename T::Client value) {
KJ_IREQUIRE(index < size());
builder.getPointerElement(guarded(index) * ELEMENTS).setCapability(kj::mv(value.hook));
builder.getPointerElement(bounded(index) * ELEMENTS).setCapability(kj::mv(value.hook));
}
inline void adopt(uint index, Orphan<T>&& value) {
KJ_IREQUIRE(index < size());
builder.getPointerElement(guarded(index) * ELEMENTS).adopt(kj::mv(value));
builder.getPointerElement(bounded(index) * ELEMENTS).adopt(kj::mv(value));
}
inline Orphan<T> disown(uint index) {
KJ_IREQUIRE(index < size());
return Orphan<T>(builder.getPointerElement(guarded(index) * ELEMENTS).disown());
return Orphan<T>(builder.getPointerElement(bounded(index) * ELEMENTS).disown());
}
typedef _::IndexingIterator<Builder, typename T::Client> Iterator;
......@@ -715,7 +715,7 @@ struct List<T, Kind::INTERFACE> {
private:
inline static _::ListBuilder initPointer(_::PointerBuilder builder, uint size) {
return builder.initList(ElementSize::POINTER, guarded(size) * ELEMENTS);
return builder.initList(ElementSize::POINTER, bounded(size) * ELEMENTS);
}
inline static _::ListBuilder getFromPointer(_::PointerBuilder builder, const word* defaultValue) {
return builder.getList(ElementSize::POINTER, defaultValue);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -369,7 +369,7 @@ public:
inline ListSchema getSchema() const { return schema; }
inline uint size() const { return unguard(reader.size() / ELEMENTS); }
inline uint size() const { return unbound(reader.size() / ELEMENTS); }
DynamicValue::Reader operator[](uint index) const;
typedef _::IndexingIterator<const Reader, DynamicValue::Reader> Iterator;
......@@ -411,7 +411,7 @@ public:
inline ListSchema getSchema() const { return schema; }
inline uint size() const { return unguard(builder.size() / ELEMENTS); }
inline uint size() const { return unbound(builder.size() / ELEMENTS); }
DynamicValue::Builder operator[](uint index);
void set(uint index, const DynamicValue::Reader& value);
DynamicValue::Builder init(uint index, uint size);
......
......@@ -311,7 +311,7 @@ inline constexpr uint sizeInWords() {
// Return the size, in words, of a Struct type, if allocated free-standing (not in a list).
// May be useful for pre-computing space needed in order to precisely allocate messages.
return unguard((upgradeGuard<uint>(_::structSize<T>().data) +
return unbound((upgradeBound<uint>(_::structSize<T>().data) +
_::structSize<T>().pointers * WORDS_PER_POINTER) / WORDS);
}
......
......@@ -29,17 +29,17 @@
namespace kj {
template <typename T, typename U>
String KJ_STRINGIFY(kj::Quantity<T, U> value) {
return kj::str(unguardAs<uint64_t>(value / kj::unit<kj::Quantity<T, U>>()));
return kj::str(unboundAs<uint64_t>(value / kj::unit<kj::Quantity<T, U>>()));
}
// Hack: Allow direct comparisons and multiplications so that we don't have to rewrite the code
// below.
template <uint64_t maxN, typename T>
inline constexpr Guarded<65535, T> operator*(uint a, Guarded<maxN, T> b) {
return assumeBits<16>(a * unguard(b));
inline constexpr Bounded<65535, T> operator*(uint a, Bounded<maxN, T> b) {
return assumeBits<16>(a * unbound(b));
}
template <uint b>
inline constexpr Guarded<65535, uint> operator*(uint a, GuardedConst<b>) {
inline constexpr Bounded<65535, uint> operator*(uint a, BoundedConst<b>) {
return assumeBits<16>(a * b);
}
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -307,17 +307,17 @@ inline ReaderFor<T> Orphan<T>::getReader() const {
template <typename T>
inline void Orphan<T>::truncate(uint size) {
_::OrphanGetImpl<ListElementType<T>>::truncateListOf(builder, guarded(size) * ELEMENTS);
_::OrphanGetImpl<ListElementType<T>>::truncateListOf(builder, bounded(size) * ELEMENTS);
}
template <>
inline void Orphan<Text>::truncate(uint size) {
builder.truncateText(guarded(size) * ELEMENTS);
builder.truncateText(bounded(size) * ELEMENTS);
}
template <>
inline void Orphan<Data>::truncate(uint size) {
builder.truncate(guarded(size) * ELEMENTS, ElementSize::BYTE);
builder.truncate(bounded(size) * ELEMENTS, ElementSize::BYTE);
}
template <typename T>
......@@ -350,7 +350,7 @@ struct Orphanage::NewOrphanListImpl<List<T, k>> {
static inline _::OrphanBuilder apply(
_::BuilderArena* arena, _::CapTableBuilder* capTable, uint size) {
return _::OrphanBuilder::initList(
arena, capTable, guarded(size) * ELEMENTS, _::ElementSizeForType<T>::value);
arena, capTable, bounded(size) * ELEMENTS, _::ElementSizeForType<T>::value);
}
};
......@@ -359,7 +359,7 @@ struct Orphanage::NewOrphanListImpl<List<T, Kind::STRUCT>> {
static inline _::OrphanBuilder apply(
_::BuilderArena* arena, _::CapTableBuilder* capTable, uint size) {
return _::OrphanBuilder::initStructList(
arena, capTable, guarded(size) * ELEMENTS, _::structSize<T>());
arena, capTable, bounded(size) * ELEMENTS, _::structSize<T>());
}
};
......@@ -367,7 +367,7 @@ template <>
struct Orphanage::NewOrphanListImpl<Text> {
static inline _::OrphanBuilder apply(
_::BuilderArena* arena, _::CapTableBuilder* capTable, uint size) {
return _::OrphanBuilder::initText(arena, capTable, guarded(size) * BYTES);
return _::OrphanBuilder::initText(arena, capTable, bounded(size) * BYTES);
}
};
......@@ -375,7 +375,7 @@ template <>
struct Orphanage::NewOrphanListImpl<Data> {
static inline _::OrphanBuilder apply(
_::BuilderArena* arena, _::CapTableBuilder* capTable, uint size) {
return _::OrphanBuilder::initData(arena, capTable, guarded(size) * BYTES);
return _::OrphanBuilder::initData(arena, capTable, bounded(size) * BYTES);
}
};
......
This diff is collapsed.
......@@ -113,12 +113,12 @@ struct PointerHelpers<T, Kind::BLOB> {
static inline typename T::Reader get(PointerReader reader,
const void* defaultValue = nullptr,
uint defaultBytes = 0) {
return reader.getBlob<T>(defaultValue, guarded(defaultBytes) * BYTES);
return reader.getBlob<T>(defaultValue, bounded(defaultBytes) * BYTES);
}
static inline typename T::Builder get(PointerBuilder builder,
const void* defaultValue = nullptr,
uint defaultBytes = 0) {
return builder.getBlob<T>(defaultValue, guarded(defaultBytes) * BYTES);
return builder.getBlob<T>(defaultValue, bounded(defaultBytes) * BYTES);
}
static inline void set(PointerBuilder builder, typename T::Reader value) {
builder.setBlob<T>(value);
......@@ -127,7 +127,7 @@ struct PointerHelpers<T, Kind::BLOB> {
builder.setBlob<T>(value);
}
static inline typename T::Builder init(PointerBuilder builder, uint size) {
return builder.initBlob<T>(guarded(size) * BYTES);
return builder.initBlob<T>(bounded(size) * BYTES);
}
static inline void adopt(PointerBuilder builder, Orphan<T>&& value) {
builder.adopt(kj::mv(value.builder));
......
......@@ -600,121 +600,121 @@ private:
inline ::capnp::rpc::twoparty::Side VatId::Reader::getSide() const {
return _reader.getDataField< ::capnp::rpc::twoparty::Side>(
::capnp::guarded<0>() * ::capnp::ELEMENTS);
::capnp::bounded<0>() * ::capnp::ELEMENTS);
}
inline ::capnp::rpc::twoparty::Side VatId::Builder::getSide() {
return _builder.getDataField< ::capnp::rpc::twoparty::Side>(
::capnp::guarded<0>() * ::capnp::ELEMENTS);
::capnp::bounded<0>() * ::capnp::ELEMENTS);
}
inline void VatId::Builder::setSide( ::capnp::rpc::twoparty::Side value) {
_builder.setDataField< ::capnp::rpc::twoparty::Side>(
::capnp::guarded<0>() * ::capnp::ELEMENTS, value);
::capnp::bounded<0>() * ::capnp::ELEMENTS, value);
}
inline ::uint32_t ProvisionId::Reader::getJoinId() const {
return _reader.getDataField< ::uint32_t>(
::capnp::guarded<0>() * ::capnp::ELEMENTS);
::capnp::bounded<0>() * ::capnp::ELEMENTS);
}
inline ::uint32_t ProvisionId::Builder::getJoinId() {
return _builder.getDataField< ::uint32_t>(
::capnp::guarded<0>() * ::capnp::ELEMENTS);
::capnp::bounded<0>() * ::capnp::ELEMENTS);
}
inline void ProvisionId::Builder::setJoinId( ::uint32_t value) {
_builder.setDataField< ::uint32_t>(
::capnp::guarded<0>() * ::capnp::ELEMENTS, value);
::capnp::bounded<0>() * ::capnp::ELEMENTS, value);
}
inline ::uint32_t JoinKeyPart::Reader::getJoinId() const {
return _reader.getDataField< ::uint32_t>(
::capnp::guarded<0>() * ::capnp::ELEMENTS);
::capnp::bounded<0>() * ::capnp::ELEMENTS);
}
inline ::uint32_t JoinKeyPart::Builder::getJoinId() {
return _builder.getDataField< ::uint32_t>(
::capnp::guarded<0>() * ::capnp::ELEMENTS);
::capnp::bounded<0>() * ::capnp::ELEMENTS);
}
inline void JoinKeyPart::Builder::setJoinId( ::uint32_t value) {
_builder.setDataField< ::uint32_t>(
::capnp::guarded<0>() * ::capnp::ELEMENTS, value);
::capnp::bounded<0>() * ::capnp::ELEMENTS, value);
}
inline ::uint16_t JoinKeyPart::Reader::getPartCount() const {
return _reader.getDataField< ::uint16_t>(
::capnp::guarded<2>() * ::capnp::ELEMENTS);
::capnp::bounded<2>() * ::capnp::ELEMENTS);
}
inline ::uint16_t JoinKeyPart::Builder::getPartCount() {
return _builder.getDataField< ::uint16_t>(
::capnp::guarded<2>() * ::capnp::ELEMENTS);
::capnp::bounded<2>() * ::capnp::ELEMENTS);
}
inline void JoinKeyPart::Builder::setPartCount( ::uint16_t value) {
_builder.setDataField< ::uint16_t>(
::capnp::guarded<2>() * ::capnp::ELEMENTS, value);
::capnp::bounded<2>() * ::capnp::ELEMENTS, value);
}
inline ::uint16_t JoinKeyPart::Reader::getPartNum() const {
return _reader.getDataField< ::uint16_t>(
::capnp::guarded<3>() * ::capnp::ELEMENTS);
::capnp::bounded<3>() * ::capnp::ELEMENTS);
}
inline ::uint16_t JoinKeyPart::Builder::getPartNum() {
return _builder.getDataField< ::uint16_t>(
::capnp::guarded<3>() * ::capnp::ELEMENTS);
::capnp::bounded<3>() * ::capnp::ELEMENTS);
}
inline void JoinKeyPart::Builder::setPartNum( ::uint16_t value) {
_builder.setDataField< ::uint16_t>(
::capnp::guarded<3>() * ::capnp::ELEMENTS, value);
::capnp::bounded<3>() * ::capnp::ELEMENTS, value);
}
inline ::uint32_t JoinResult::Reader::getJoinId() const {
return _reader.getDataField< ::uint32_t>(
::capnp::guarded<0>() * ::capnp::ELEMENTS);
::capnp::bounded<0>() * ::capnp::ELEMENTS);
}
inline ::uint32_t JoinResult::Builder::getJoinId() {
return _builder.getDataField< ::uint32_t>(
::capnp::guarded<0>() * ::capnp::ELEMENTS);
::capnp::bounded<0>() * ::capnp::ELEMENTS);
}
inline void JoinResult::Builder::setJoinId( ::uint32_t value) {
_builder.setDataField< ::uint32_t>(
::capnp::guarded<0>() * ::capnp::ELEMENTS, value);
::capnp::bounded<0>() * ::capnp::ELEMENTS, value);
}
inline bool JoinResult::Reader::getSucceeded() const {
return _reader.getDataField<bool>(
::capnp::guarded<32>() * ::capnp::ELEMENTS);
::capnp::bounded<32>() * ::capnp::ELEMENTS);
}
inline bool JoinResult::Builder::getSucceeded() {
return _builder.getDataField<bool>(
::capnp::guarded<32>() * ::capnp::ELEMENTS);
::capnp::bounded<32>() * ::capnp::ELEMENTS);
}
inline void JoinResult::Builder::setSucceeded(bool value) {
_builder.setDataField<bool>(
::capnp::guarded<32>() * ::capnp::ELEMENTS, value);
::capnp::bounded<32>() * ::capnp::ELEMENTS, value);
}
inline bool JoinResult::Reader::hasCap() const {
return !_reader.getPointerField(
::capnp::guarded<0>() * ::capnp::POINTERS).isNull();
::capnp::bounded<0>() * ::capnp::POINTERS).isNull();
}
inline bool JoinResult::Builder::hasCap() {
return !_builder.getPointerField(
::capnp::guarded<0>() * ::capnp::POINTERS).isNull();
::capnp::bounded<0>() * ::capnp::POINTERS).isNull();
}
inline ::capnp::AnyPointer::Reader JoinResult::Reader::getCap() const {
return ::capnp::AnyPointer::Reader(_reader.getPointerField(
::capnp::guarded<0>() * ::capnp::POINTERS));
::capnp::bounded<0>() * ::capnp::POINTERS));
}
inline ::capnp::AnyPointer::Builder JoinResult::Builder::getCap() {
return ::capnp::AnyPointer::Builder(_builder.getPointerField(
::capnp::guarded<0>() * ::capnp::POINTERS));
::capnp::bounded<0>() * ::capnp::POINTERS));
}
inline ::capnp::AnyPointer::Builder JoinResult::Builder::initCap() {
auto result = ::capnp::AnyPointer::Builder(_builder.getPointerField(
::capnp::guarded<0>() * ::capnp::POINTERS));
::capnp::bounded<0>() * ::capnp::POINTERS));
result.clear();
return result;
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -158,7 +158,7 @@ private:
template <typename T>
class Locked {
// Return type for `MutexGuarded<T>::lock()`. `Locked<T>` provides access to the guarded object
// Return type for `MutexGuarded<T>::lock()`. `Locked<T>` provides access to the bounded object
// and unlocks the mutex when it goes out of scope.
public:
......@@ -208,7 +208,7 @@ private:
template <typename T>
class MutexGuarded {
// An object of type T, guarded by a mutex. In order to access the object, you must lock it.
// An object of type T, bounded by a mutex. In order to access the object, you must lock it.
//
// Write locks are not "recursive" -- trying to lock again in a thread that already holds a lock
// will deadlock. Recursive write locks are usually a sign of bad design.
......@@ -223,7 +223,7 @@ class MutexGuarded {
public:
template <typename... Params>
explicit MutexGuarded(Params&&... params);
// Initialize the mutex-guarded object by passing the given parameters to its constructor.
// Initialize the mutex-bounded object by passing the given parameters to its constructor.
Locked<T> lockExclusive() const;
// Exclusively locks the object and returns it. The returned `Locked<T>` can be passed by
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment