代码拉取完成,页面将自动刷新
package concurrent
import (
"container/list"
"sync"
)
type ConcurrentList struct {
list *list.List
mutex sync.Mutex
}
func New() *ConcurrentList {
return &ConcurrentList{list: list.New()}
}
func (c *ConcurrentList) Front() *list.Element {
return c.list.Front()
}
func (c *ConcurrentList) Back() *list.Element {
return c.list.Back()
}
func (c *ConcurrentList) MoveToFront(e *list.Element) {
c.mutex.Lock()
defer c.mutex.Unlock()
c.list.MoveToFront(e)
}
func (c *ConcurrentList) MoveToBack(e *list.Element) {
c.mutex.Lock()
defer c.mutex.Unlock()
c.list.MoveToBack(e)
}
func (c *ConcurrentList) MoveAfter(e *list.Element, mark *list.Element) {
c.mutex.Lock()
defer c.mutex.Unlock()
c.list.MoveAfter(e, mark)
}
func (c *ConcurrentList) InsertAfter(v interface{}, mark *list.Element) {
c.mutex.Lock()
defer c.mutex.Unlock()
c.list.InsertAfter(v, mark)
}
func (c *ConcurrentList) InsertBefore(v interface{}, mark *list.Element) {
c.mutex.Lock()
defer c.mutex.Unlock()
c.list.InsertBefore(v, mark)
}
func (c *ConcurrentList) PushFront(v interface{}) {
c.mutex.Lock()
defer c.mutex.Unlock()
c.list.PushFront(v)
}
func (c *ConcurrentList) Remove(e *list.Element) {
c.mutex.Lock()
defer c.mutex.Unlock()
c.list.Remove(e)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。