Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Timeout = errors.New("update timeout") Block = errors.New("update is running, try again") )
rcu errors
Functions ¶
This section is empty.
Types ¶
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value is an rcu value used as rcu lock, have no export fields, can keep any data
func (*Value) Load ¶
func (v *Value) Load() interface{}
Load returns the keeped data, data used count will add one
func (*Value) Put ¶
func (v *Value) Put(i interface{})
Put the data back, the used count will decrease one If put a data before Load, it will panic
func (*Value) Update ¶
Update can update the value directly, but will return success until the data used count is zero or reach timeout If it is reached timeout, it will returns a timeout error with value updated If a Update is not returned, the other Update will be blocked, and returns a block error without value updated
Click to show internal directories.
Click to hide internal directories.