Comments (4)
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.
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.
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.
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)
- orientation: app.conf HOT 1
- screen always on HOT 1
- TOOLBOX
- Sending Byte arrays through BLE
- Site: phone.app - certificate expired on 11/10/2021 HOT 3
- No example for sms send/receive HOT 2
- vertical slider and midi device examples HOT 1
- Can not access the webpage HOT 1
- getting started link on README does not work HOT 1
- Voice recognition without the recognizer's UI HOT 1
- Is it possible in PHONK to create a transparent widget that hovers over other activities ... HOT 1
- How to do linear layouts?
- `PHttpServer` and `PFtpServer` won't be stopped
- TypeScript declaration HOT 3
- Widget TextList: text size doesn't apply HOT 2
- `NativeArray.subarray` is broken
- Widget `.text()` and `.html()` don't set `.props.text` HOT 12
- `PLinearLayout.add` with weight doesn't work
- certificate expired HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phonk.