mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-14 16:03:41 +00:00
internal/task: implement PMutex
PMutex is a mutex when threading is possible, and a dummy mutex-like object (that doesn't do anything) otherwise.
This commit is contained in:
@@ -0,0 +1,16 @@
|
|||||||
|
package task
|
||||||
|
|
||||||
|
// 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 PMutex struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PMutex) Lock() {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PMutex) Unlock() {
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user