semaphore, pgraph: Add semaphore grouping and tests

If two resources are grouped, then the result should contain the
semaphores of both resources. This is because the user is expecting
(independently) resource A and resource B to have a limiting choke
point. If when combined those choke points aren't preserved, then we
have broken an important promise to the user.
This commit is contained in:
James Shubin
2017-02-28 16:34:21 -05:00
parent 646a576358
commit 018399cb1f
4 changed files with 118 additions and 2 deletions

View File

@@ -57,7 +57,7 @@ func Uint64KeyFromStrInMap(needle string, haystack map[uint64]string) (uint64, b
}
// StrRemoveDuplicatesInList removes any duplicate values in the list.
// This is a possibly sub-optimal, O(n^2)? implementation.
// This implementation is possibly sub-optimal (O(n^2)?) but preserves ordering.
func StrRemoveDuplicatesInList(list []string) []string {
unique := []string{}
for _, x := range list {