Modified blocking return to have more intuitive behavior#19
Modified blocking return to have more intuitive behavior#19chentom88 wants to merge 1 commit intonelsam:masterfrom
Conversation
|
That's interesting. Give me a bit to think on it, but I like the idea. |
|
Could we instead take advantage of the |
|
@apoydence: How would that work? Do you mean something like this? func BlockSend(calledField *chan bool) chan<- struct{} {
oldChan := *calledField
newChan := make(chan bool)
*calledField = newChan
signalUnblock := make(chan struct{})
go func() {
<-signalUnblock
v := <-newChan
oldChan <- v
*calledField = oldChan
}()
return signalUnblock
}http://play.golang.org/p/LBRhQFTdKq There are obviously data races there, but the basic idea is to re-assign the It would require a change to hel's mocks, too, to defer the |
Instead of methods blocking by default, changed blocking return behavior to require user activation. Also created an additional channel that can be used to unblock a mock method call once it has been set to blocked.