-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Frank Martinez
committed
Aug 10, 2018
1 parent
0cdd532
commit 7d11eee
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package channels | ||
|
||
var channels = make(map[string]chan interface{}) | ||
|
||
// Count returns the number of channels | ||
func Count() int { | ||
return len(channels) | ||
} | ||
|
||
// Add adds an engine channel, assumes these are created before startup | ||
func Add(name string){ | ||
//todo add size? | ||
channels[name] = make(chan interface{}) | ||
} | ||
|
||
// Get gets the named channel | ||
func Get(name string) chan interface{} { | ||
return channels[name] | ||
} | ||
|
||
//Close closes all the channels, assumes it is called on shutdown | ||
func Close() { | ||
for _, value := range channels { | ||
close(value) | ||
} | ||
} |
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