Skip to content

Srikrishnabh/tlock

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TLock

Build

Simple Golang Lock with Timeout support.

Install

  • go get github.com/shettyh/tlock

How to use

// Create lock
tlock := tlock.New()

//blocking Lock/unlock
tlock.Lock()
defer tlock.Unlock()


// non-blocking lock/unlock
if tlock.TryLock() {
    defer tlock.Unlock()
    ...
}


// block lock/unlock with timeout
if tlock.TryLockWithTimeout(time.Seconds * 10 ) {
    defer tlock.Unlock()
    ...
}

For detailed example please check the examples folder

About

Golang Lock with Timeout

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%