Skip to content

v3: replace channel in Future with a cond.Sync #496

@oleg-jukovec

Description

@oleg-jukovec

The channel:

done chan struct{}

Is used to notify a waiter about a response. It could be easily replaced with a condition variable + boolean value.

But it's not that simple. We also have a method that returns a channel to the user. In this case we need to create the channel on demand:

go-tarantool/future.go

Lines 127 to 133 in e72726b

// WaitChan returns channel which becomes closed when response arrived or error occurred.
func (fut *Future) WaitChan() <-chan struct{} {
if fut.done == nil {
return closedChan
}
return fut.done
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions