Giter Club home page Giter Club logo

Comments (4)

victordiaz avatar victordiaz commented on May 25, 2024

Hi @notEvil,
Most of the callbacks should run on the UI thread, just for simplicity sake when using some date from a callback in a UI element.

The HttpServer was not posting the data in the message queue because IIRC I had some issues with long data transfers. If you find a better way I will be happy to accept a PR to improve it :)

from phonk.

notEvil avatar notEvil commented on May 25, 2024

I agree, one shouldn't be concerned about threads and PHttpServer seems to be an exception. This detail should be in the docs as it could potentially lead to race conditions. And because it is so easy to mix JS with Java code, maybe also have a separate document on this topic?

On a side note: just tested and confirmed my suspicion. Sensor callbacks are called by the main thread (using android.os.Process.myTid). Additionally, activities and services run on the same thread. This is probably common knowledge but it wasn't plain to me.

from phonk.

victordiaz avatar victordiaz commented on May 25, 2024

Yes, I agree. If you want you can add some documentation in the method itself or if you want you can add something to the Github wik as .md that I can include also in the websitei.

I will be happy to add more docs. I just never had the time. I think this is a great opportunity to improve it.

from phonk.

notEvil avatar notEvil commented on May 25, 2024

The HttpServer was not posting the data in the message queue because IIRC I had some issues with long data transfers.

So you had the thread wait for the response at some point? Thats what I would do, and in case of large responses triggering the request timeout, it is still possible to do it asynchronously (e.g. respond nothing and do a request in the other direction).

from phonk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.