feat(darwin): add WithContext operations#387
feat(darwin): add WithContext operations#387acouvreur wants to merge 4 commits intotinygo-org:devfrom
WithContext operations#387Conversation
…hContext WriteWithContext and ReadWithContext Related tinygo-org#339
|
@deadprogram @aykevl can I get your review on this ? If this implementation is satisfying to you, I can do it for Windows and Linux too. |
WithContext operations
|
Any update about adding |
|
@deadprogram @jagobagascon is there any way we can go forward with this ? I can implement all context methods for Darwin, Windows and Linux. But before I go any further I'd like to get an approval from your part concerning the initial design. |
|
Related work #429 This PR needs to be updated to use the base GAPDevice interface. It will probably need to introduce the GAPDeviceService interface. |
|
As an idea this is sound. Might mean more heap allocations though. LGTM |
| // StopScan is called). | ||
| select { | ||
| case <-ctx.Done(): | ||
| err = a.StopScan() |
There was a problem hiding this comment.
Wouldn't this cause deadlock, since scanChan is unbuffered, and StopScan writes to it while nothing is reading from it?
I've just done these changes for
darwinbecause I am working on MacOS.I can implement it for
windowsandlinuxif this change is accepted.I can also work in adding context in different apis, such asDiscoverServices,DiscoverCharacteristicsandScan.I've added the context implementation for
DiscoverServicesWithContextDiscoverCharacteristicsWithContextWriteWithContextandReadWithContextin 434206bRelated #339