Skip to content

Instantly share code, notes, and snippets.

@coolwanglu
coolwanglu / ipc_nodejs_addon.cc
Last active October 24, 2019 09:49
ChromeVFX Prototype
void receive_request(const FunctionCallbackInfo<Value>& args) {
unsigned int priority;
double msg;
boost::interprocess::message_queue::size_type recvd_size;
message_queue_request_->receive(&msg, sizeof(msg), recvd_size, priority);
auto* isolate = args.GetIsolate();
args.GetReturnValue().Set(Number::New(isolate, msg));
}
void send_response(const FunctionCallbackInfo<Value>& args) {
@coolwanglu
coolwanglu / Semaphore
Last active December 30, 2015 06:09
Hynopic Demos
/*
* Hypnotic can be extended
* Here we have a simple semaphore introduced
* which supports only one producer/consumer
*/
// jQuery still works, of course!
function print(msg){ $('#output').html(msg); }
/*