Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/mobile/exp/sensor: simplify os thread proxifying mechanism on Android #12462

rakyll opened this Issue Sep 3, 2015 · 0 comments


None yet
2 participants
Copy link

rakyll commented Sep 3, 2015

The Android implementation of the sensor package need to initialize a ALooper. ALoopers must be accessed from the same OS thread, therefore each operation on the package must be done on a goroutine that is locked to an OS thread.

The current mechanism accepts new messages through a signal channel depending on the signals type, invokes the required functions and sets the return values. It requires each function call to be represented with a different input signal.

This mechanism could be simplified by making the locked goroutine consuming a chan of functions.

type inOut func(done chan struct{})

m.inOut <- func(done chan struct{}) {
    // do something on the locked goroutine
    // when done, close done.

@rakyll rakyll self-assigned this Sep 3, 2015

@rakyll rakyll added this to the Unreleased milestone Sep 3, 2015

@gopherbot gopherbot added the mobile label Jul 20, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.