# concurrent **Repository Path**: nrgo/concurrent ## Basic Information - **Project Name**: concurrent - **Description**: concurrent package for nrgo - **Primary Language**: Go - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-02-19 - **Last Updated**: 2023-04-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # concurrent #### 介绍 concurrent package for nrgo ### 资源锁 ------ #### 接口定义 ```go // Locker 定义资源锁接口 type Locker interface { // Apply 锁定一个用 flag 标记的资源 // @flag 标记资源的 flag // @releaseDuration 自动释放的时间间隔 // returns 是否能获取到锁 Apply(flag string, releaseDuration ...time.Duration) bool // Release 释放一个用 flag 标记的资源 Release(flag string) // Locked 查询并返回一个资源是否被锁定 Locked(flag string) bool } ``` #### 使用说明 ```go locker := NewBuiltinResLocker() ```