Native addon that can pass typed arrays between threads

57 views
Skip to first unread message

vroad

unread,
May 28, 2015, 8:44:39 PM5/28/15
to nod...@googlegroups.com
I'm looking for a way to load an WebP image, decode it, and send it to main thread from background thread.
I'm using dlopen implementation copied from node source file in the background thread. You may think that it's bad practice, but I want this for my node-based desktop application.

At first, I added dlopen to node-webworker-threads and called that from background thread. DLOpen worked, but crashed while deserializing object. I gave up debugging since I was not sure what was causing the issue.
Then I tried npool. It provides me with better API than node-webworker-threads and seemed not buggy as node-webworker-threads, that's good, but doesn't work with large objects like typed arrays, because this addon uses stringified JSON to communicate between threads.

Do you know any other native addon that supports passing typed arrays between threads?

vroad

unread,
Jun 4, 2015, 9:42:30 AM6/4/15
to nod...@googlegroups.com
I ended up creating my own structured clone implementation... https://github.com/vroad/nPool


2015年5月29日金曜日 9時44分39秒 UTC+9 vroad:

inh3

unread,
Aug 11, 2015, 3:04:54 PM8/11/15
to nodejs
Hi vroad,

I am the creator of nPool.  I'm glad you found the package easier to work with than node-webworker-threads.  I too ran into issues using it and I don't particularly like the web worker API.

I saw your work with the structured clone implementation.  I like this a lot.  Do you mind if I bring this functionality back into nPool?

vroad

unread,
Aug 28, 2015, 10:42:42 PM8/28/15
to nodejs
Hi inh3,

It's fine to bring my structured clone implementation to your repository, of course.
If you come up with better names for these classes I wrote, please change them.
Reply all
Reply to author
Forward
0 new messages