golockerreentrancycontext

package module
v0.0.0-...-9002671 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2024 License: GPL-3.0 Imports: 1 Imported by: 1

README

C++, C, D, Python -- all have re-entrant Lock support. Go - doesn't.

there are some hack Go packages, which try to get Goroutine id and use it 
to base Mutex locking on.

current package suggests the other approach to this problem, by 
creating Mutex using context in space of function call (on stack)
so Mutex locking is based on call context. this context is shared 
via function parameter.

see example usage in tests directory

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LockerReentrancyContext

type LockerReentrancyContext struct {
	OwnLock     sync.Mutex
	LockerItems []*LockerReentrancyContextItem
}

func (*LockerReentrancyContext) LockMutex

func (self *LockerReentrancyContext) LockMutex(subject *sync.Mutex)

func (*LockerReentrancyContext) UnlockMutex

func (self *LockerReentrancyContext) UnlockMutex(subject *sync.Mutex)

type LockerReentrancyContextItem

type LockerReentrancyContextItem struct {
	Subject sync.Locker
	Counter int
}

Directories

Path Synopsis
tests
test01 module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL