Skip to content

Instantly share code, notes, and snippets.

@hauxe
Last active June 21, 2018 06:41
Show Gist options
  • Save hauxe/f2c45936bfb009ca29c1263847fa58c4 to your computer and use it in GitHub Desktop.
Save hauxe/f2c45936bfb009ca29c1263847fa58c4 to your computer and use it in GitHub Desktop.
// 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