When terminating the Context, wait for the background goroutine
to sync on c.done channel before exiting.
This commit is contained in:
@@ -133,7 +133,7 @@ func (c *Context) OpenDeviceWithVidPid(vid, pid int) (*Device, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context) Close() error {
|
func (c *Context) Close() error {
|
||||||
close(c.done)
|
c.done <- struct{}{}
|
||||||
if c.ctx != nil {
|
if c.ctx != nil {
|
||||||
C.libusb_exit(c.ctx)
|
C.libusb_exit(c.ctx)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user