mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-07 04:23:41 +00:00
runtime: make channels parallelism-safe
This commit is contained in:
committed by
Ron Evans
parent
17302ca762
commit
6110f0bc1b
@@ -27,7 +27,7 @@ type Task struct {
|
||||
}
|
||||
|
||||
// DataUint32 returns the Data field as a uint32. The value is only valid after
|
||||
// setting it through SetDataUint32.
|
||||
// setting it through SetDataUint32 or by storing to it using DataAtomicUint32.
|
||||
func (t *Task) DataUint32() uint32 {
|
||||
return *(*uint32)(unsafe.Pointer(&t.Data))
|
||||
}
|
||||
@@ -38,6 +38,11 @@ func (t *Task) SetDataUint32(val uint32) {
|
||||
*(*uint32)(unsafe.Pointer(&t.Data)) = val
|
||||
}
|
||||
|
||||
// DataAtomicUint32 returns the Data field as an atomic-if-needed Uint32 value.
|
||||
func (t *Task) DataAtomicUint32() *Uint32 {
|
||||
return (*Uint32)(unsafe.Pointer(&t.Data))
|
||||
}
|
||||
|
||||
// getGoroutineStackSize is a compiler intrinsic that returns the stack size for
|
||||
// the given function and falls back to the default stack size. It is replaced
|
||||
// with a load from a special section just before codegen.
|
||||
|
||||
Reference in New Issue
Block a user