| <<<Back 1 day (to 2017/05/16) | 20170517 |
ymy | Can I run mujs in iOS? And Is it thread safe? | 09:58.06 |
| I will make sure only one thread can access State at a time | 10:03.04 |
Robin_Watts | mujs is vanilla C I believe, so it should compile and run almost anywhere, including iOS. | 10:04.29 |
| I do not believe we offer any special packaging for iOS. | 10:04.46 |
| If, as you say, you make sure that only one thread is calling into mujs at a time, then I cannot see why it would not be "thread safe" :) | 10:05.17 |
ymy | I used Spidermonkey before, and it can only run js code in main thread | 10:06.09 |
jogux | obviously if you want to bind to UI elements that presents an issue (you can only call UIKit /from/ the main thread) and you'll need to sort out some locking. | 10:07.42 |
| (unrelated, but also Apple have various rules that means AppStore apps that download JS on the fly are likely to get you pulled from the store when they find out.) | 10:08.14 |
ymy | You mean if I use mujs,apple will refuse my app? | 10:10.02 |
| I want to know that do we have limit that only one thread can access State at the same time? | 10:10.41 |
jogux | no. mujs is fine. If you download JS scripts from a server on the fly, that might get you in trouble - same rule would apply with any JS engine (other than Apple's own in UIWebView). | 10:10.49 |
ymy | OK, I know this,JSPatch is not fine | 10:11.31 |
jogux | exactly. | 10:11.50 |
ymy | Could tell my last question?(Do we have limit that only one thread can access State at the same time?) | 10:12.25 |
jogux | you can only use mujs from one thread at a time. | 10:14.20 |
ymy | OK, thank you very much! | 10:17.08 |
| I used duktape before, duktap limits that only one native thread can execute code in the heap at a time. I also want to know if mujs can use one native thread to execute code, and another thread to get property or data from State or the stack | 10:27.04 |
| at the same time | 10:27.23 |
| If I am using JS variables, and GC triggers at the sametime, how to hold the variables in c code? | 12:28.19 |
sebras | ymy: tor8, who knows mujs the best is not here today. he will be back tomorrow. | 13:09.18 |
| ymy: just so you know you may have to wait for answers. | 13:10.06 |
ymy | OKï¼thank you! I will wait for he | 13:11.34 |
avih | jogux: as far as i know, you can use it from as many threads as you like, provided that either: 1. you don't use the same js_Context* from different threads, or 2, you do use the same J from different threads, but use your own thread safety measures to make sure only one thread at a time uses the API (that includes using values you obtained from the API, like strings) | 14:29.15 |
jogux | avih: that matches my understanding. | 14:29.46 |
avih | sorry, js_State of course :) | 14:30.13 |
jogux | so you can't (as ymy was asking) retrieve a value from javascript whilst (say) the garbage collector is running. | 14:30.25 |
avih | the gc runs in the same thread as you call the api from. when the api call returned, it's already GC'ed | 14:30.59 |
| and invoking the gc manually is the same as every other api | 14:31.24 |
jogux | yeah. so whichever way you skin it, you risk stalling the main UI thread if it needs to retrieve a value from JS. | 14:32.23 |
avih | however, knowing the implementation details (which could change) some things can work from multiple threads concurrently, for instance js_getcontext doesn't access any vm data structures other than returning J->uctx, so that wouldn't be a problem. | 14:32.37 |
| jogux: yes. depending on gc implementation, it could be incremental such that it never blocks for too long on each gc. but not familiar with mujs' gc | 14:33.29 |
| in general, you shouldn't care about gc, and if you do, manually gc before something you need with as least gc as possible | 14:34.09 |
Robin_Watts | avih: Urm... If you're marking and sweeping, then you can't "only partially mark and sweep" | 15:28.23 |
| you need to do a complete mark/sweep pass - you can't do that incrementally. | 15:28.52 |
avih | right, but it's not like mujs promises to never change to a different gc :) | 15:34.37 |
john__ | hi , can we separate multi pdf page to single pdf pages? | 17:11.04 |
| Forward 1 day (to 2017/05/18)>>> | |