Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Futex ¶ added in v0.35.0
type Futex struct { Uint32 // contains filtered or unexported fields }
A futex is a way for userspace to wait with the pointer as the key, and for another thread to wake one or all waiting threads keyed on the same pointer.
A futex does not change the underlying value, it only reads it before to prevent lost wake-ups.
type PMutex ¶ added in v0.35.0
type PMutex struct { }
PMutex is a real mutex on systems that can be either preemptive or threaded, and a dummy lock on other (purely cooperative) systems.
It is mainly useful for short operations that need a lock when threading may be involved, but which do not need a lock with a purely cooperative scheduler.
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue is a FIFO container of tasks. The zero value is an empty queue.
func (*Queue) Append ¶
Append pops the contents of another queue and pushes them onto the end of this queue.
type Stack ¶
type Stack struct {
// contains filtered or unexported fields
}
Stack is a LIFO container of tasks. The zero value is an empty stack. This is slightly cheaper than a queue, so it can be preferable when strict ordering is not necessary.
type Task ¶
type Task struct { // Next is a field which can be used to make a linked list of tasks. Next *Task // Ptr is a field which can be used for storing a pointer. Ptr unsafe.Pointer // Data is a field which can be used for storing state information. Data uint64 // DeferFrame stores a pointer to the (stack allocated) defer frame of the // goroutine that is used for the recover builtin. DeferFrame unsafe.Pointer // contains filtered or unexported fields }
Task is a state of goroutine for scheduling purposes.
func (*Task) DataAtomicUint32 ¶ added in v0.35.0
DataAtomicUint32 returns the Data field as an atomic-if-needed Uint32 value.
func (*Task) DataUint32 ¶ added in v0.35.0
DataUint32 returns the Data field as a uint32. The value is only valid after setting it through SetDataUint32 or by storing to it using DataAtomicUint32.
func (*Task) SetDataUint32 ¶ added in v0.35.0
SetDataUint32 updates the uint32 portion of the Data field (which could be the first 4 or last 4 bytes depending on the architecture endianness).
type Uint32 ¶ added in v0.35.0
type Uint32 = pseudoAtomic[uint32]
Uint32 is an atomic uint32 when multithreading is enabled, and a plain old uint32 otherwise.