Panther Search Documentation Tutorials Devlogs Downloads Source Code

Documentation > Panther Documentation > Intrinsics > Builtin Module @pthr

Builtin Module @pthr

Panther
Documentation


AtomicOrdering

type AtomicOrdering = enum {
	MONOTONIC,
	ACQUIRE,
	RELEASE,
	ACQ_REL,
	SEQ_CST,
}

Enum to specify the different atomic orderings. All orderings guarantee atomicity. Use of any ordering other than SEQ_CST should only be done if the developer is 100% sure it is safe to do so.

MONOTONIC

  Has no synchronization or ordering constraints. Can be used on any atomic operation.

  This is equivalent to "relaxed" in C/C++.

ACQUIRE

  No memory operations in the current thread can be reordered to before this operation. Can be used on load atomic operations.

RELEASE

  No memory operations in the current thread can be reordered to after this operation. Can be used on store atomic operations.

ACQ_REL

  Acquire Release. Performs an acquire and a release operation. No memory operations in the current thread can be reordered to before acquire or to after the release. Can be used on read-modify-write atomic operation.

SEQ_CST

  Sequentially-consistent. Performs an acquire for a load, a release for a store, acquire-release for a read-modify-write operation. In addition, all threads observe all modifications in the same order. Can be used on any atomic operation.

AtomicRMWOp

type AtomicRMWOp = enum {
	XCHG,
	ADD,
	SUB,
	AND,
	NAND,
	OR,
	XOR,
	MIN,
	MAX,
}

  For use in @atomicRMW to denote the operation to use.

Iterable Interfaces

IIterable / IIterableRT

interface IIterable = {
	func createIterator = (this) -> impl($$:@pthr.IIterator);
	func createIterator = (this mut) -> impl($$:@pthr.IMutIterator);
}

interface IIterableRT = {
	func createIterator = (this) #rt -> impl($$:@pthr.IIterator);
	func createIterator = (this mut) #rt -> impl($$:@pthr.IMutIterator);
}

Interface to define iterable types. Should be used if the type uses the array iterable model.

IIterableRef / IIterableRefRT

interface IIterableRef = {
	func createIterator = (this) -> impl($$:@pthr.IIterator);
}

interface IIterableRefRT = {
	func createIterator = (this) #rt -> impl($$:@pthr.IIterator);
}

Interface to define iterable types. Should be used if the type uses the array reference iterable model.

IIterableMutRef / IIterableMutRefRT

interface IIterableMutRef = {
	func createIterator = (this) -> impl($$:@pthr.IMutIterator);
}

interface IIterableMutRefRT = {
	func createIterator = (this) #rt -> impl($$:@pthr.IMutIterator);
}

Interface to define iterable types. Should be used if the type uses the mutable array reference iterable model.

Iterator Interfaces

IIterator / IIteratorRT

interface IIterator = {
	func next = (this mut) -> Void;
	func get = (this) -> $$*;
	func atEnd = (this) -> Bool;
}

interface IIteratorRT = {
	func next = (this mut) #rt -> Void;
	func get = (this) #rt -> $$*;
	func atEnd = (this) #rt -> Bool;
}

Interface to define an iterator.

IMutIterator / IMutIteratorRT

interface IMutIterator = {
	func next = (this mut) -> Void;
	func get = (this) -> $$*mut;
	func atEnd = (this) -> Bool;
}

interface IMutIteratorRT = {
	func next = (this mut) #rt -> Void;
	func get = (this) #rt -> $$*mut;
	func atEnd = (this) #rt -> Bool;
}

Interface to define a mut iterator.