Skip to content

feat(darwin): add WithContext operations#387

Draft
acouvreur wants to merge 4 commits intotinygo-org:devfrom
acouvreur:add-ConnectWithContext
Draft

feat(darwin): add WithContext operations#387
acouvreur wants to merge 4 commits intotinygo-org:devfrom
acouvreur:add-ConnectWithContext

Conversation

@acouvreur
Copy link
Copy Markdown
Contributor

@acouvreur acouvreur commented Oct 4, 2025

I've just done these changes for darwin because I am working on MacOS.

I can implement it for windows and linux if this change is accepted.

I can also work in adding context in different apis, such as DiscoverServices, DiscoverCharacteristics and Scan.

I've added the context implementation for DiscoverServicesWithContext DiscoverCharacteristicsWithContext WriteWithContext and ReadWithContext in 434206b

Related #339

…hContext WriteWithContext and ReadWithContext

Related tinygo-org#339
@acouvreur acouvreur changed the base branch from release to dev October 12, 2025 21:26
@acouvreur
Copy link
Copy Markdown
Contributor Author

acouvreur commented Dec 1, 2025

@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.

@acouvreur acouvreur changed the title feat(gap): add ConnectWithContext in gap_darwin.go feat(darwin): add WithContext operations Dec 1, 2025
@acouvreur
Copy link
Copy Markdown
Contributor Author

Any update about adding context.Context to all operations @deadprogram ?

@acouvreur
Copy link
Copy Markdown
Contributor Author

@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.

@acouvreur acouvreur marked this pull request as draft March 16, 2026 19:25
@acouvreur
Copy link
Copy Markdown
Contributor Author

Related work #429

This PR needs to be updated to use the base GAPDevice interface.

It will probably need to introduce the GAPDeviceService interface.

@soypat
Copy link
Copy Markdown

soypat commented Mar 30, 2026

As an idea this is sound. Might mean more heap allocations though. LGTM

// StopScan is called).
select {
case <-ctx.Done():
err = a.StopScan()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this cause deadlock, since scanChan is unbuffered, and StopScan writes to it while nothing is reading from it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants