This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-06-25
Channels
- # beginners (21)
- # boot (37)
- # cljsjs (1)
- # cljsrn (1)
- # clojure (48)
- # clojure-greece (3)
- # clojure-poland (1)
- # clojure-quebec (4)
- # clojure-spec (40)
- # clojure-uk (1)
- # clojurescript (113)
- # cursive (13)
- # events (3)
- # hoplon (183)
- # jobs (5)
- # off-topic (2)
- # onyx (49)
- # planck (35)
- # re-frame (8)
- # reagent (2)
- # sim-testing (1)
- # specter (4)
- # spirituality-ethics (2)
- # untangled (1)
- # vim (2)
- # yada (1)
Just discovered this: JSObjectCallAsFunction
: https://lists.webkit.org/pipermail/webkit-help/2011-January/001849.html
But I have bigger problems here now: can't do any JS/webkit/javascriptcore call from the bkg thread and I'm not sure how I could even send a message from the bkg thread to the main thread. Any ideas on that one?
JavaScriptCore is supposed to be thread-safe. So you should be able to call into it from any thread.
So, i can get a single JSValueMakeNumber to succeed, put it in an array and then try to create an object from that array with JSObjectMakeArray but it seg faults on the make array call
If it is doing that the first thing I’d do is uncomment the memory diagnostic sanitize address thing in the Makefile: https://github.com/mfikes/planck/blob/master/planck-c/Makefile#L7
oh, found one stupid mistake. but after fixing that the previous (and serious one) still remains
perhaps either a) that ctx isn't as permanent as we thought or b) ctx's can't be shared between threads like that .
Well, if it helps narrow it down, I’ve never had it SEGV on me by calling from different threads.
Well, so the API itself, JavaScriptCore, is a thread safe API.
You can call into various JSContext and evaluate code and create values and that sort of thing on different threads and everything will work fine.
Good video on it, that’s from the transcript: http://asciiwwdc.com/2013/sessions/615
@johanatan: a bit late to the party, but I’ve done this
basically, when I want to listen to a socket, I pass a callback, in the form of a String: https://github.com/slipset/planck/blob/sockets/planck/PLKClojureScriptEngine.m#L713-L732
@mfikes: that's weird. I can't see anything else it could be. My JSContext looks legit and I was just previously able to create a JSNumber on it
And taking that number, packing it in an array and calling JSObjectMakeArray causes the segfault
@johanatan: yeah, I may have some free time tonight to take a look
@johanatan: no, it's running in the same thread, but I needed a way to get noticed when someone wrote on the socket, hence the callback.