Don't think so unless you want to go the Python GIL route (just say no!).
I have an idea that I would like to test soon: for one C++ function
called from JavaScript to make multiple trips into and out of the
thread-pool (i.e. call eio_custom again from the eio "after"
function). This way, you could maintain a "in progress" data-structure
that you add to every time you come out of the thread pool with your
little "bite sized" data structures. In the node-sqlite case, I'd have
a v8 array, and pull out say, 100 rows at a time to append to it.
Of course, this supposes that you have a job that can be broken up
into pieces (which works great for sqlite.)
Anyways, just something to think about :)
> --
> You received this message because you are subscribed to the Google Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com.
> To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/nodejs?hl=en.
>
>
--
Orlando Vazquez
Can't you wrap the C++ class/struct with ObjectWrap::Wrap() and expose
it to V8 that way (all from the main thread, of course)? Saves copying
the data around.
While it is not an answer to the copying issue, the node protocol
buffer mapping (http://code.google.com/p/protobuf-for-node/) can help
you with the code duplication issue. It allows you to formulate the
native interface in terms of a protocol buffer service, automates the
placement on the eio pool, let's you build up the protocol buffer
response while on the eio thread and automates the marshalling to JS
back on the main thread without ever touching either eio or v8 api.
http://code.google.com/p/protobuf-for-node/source/browse/example/protoservice.cc
shows an example of a getpwent wrapper.
Massaging a streaming response into this would be interesting.
Matthias
Interesting technique. Is there a performance trade-off compared to a
one-time copy?