Last active
June 21, 2018 06:41
-
-
Save hauxe/f2c45936bfb009ca29c1263847fa58c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PrioritizedEntity interface | |
type PrioritizedEntity interface { | |
GetPriority() int | |
AccessResource(interface{}) | |
} | |
// GreedyMutex a mutex that handles greedy entities with higher priority | |
type GreedyMutex struct { | |
sync.Mutex | |
TimeToWait time.Duration | |
queue chan PrioritizedEntity | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment