Print this page
enable v8plus_call to be used in any thread

Split Close
Expand all
Collapse all
          --- old/./v8plus_subr.cc
          +++ new/./v8plus_subr.cc
↓ open down ↓ 408 lines elided ↑ open up ↑
 409  409          } else {
 410  410                  msg = _v8plus_errmsg;
 411  411          }
 412  412  
 413  413          exception = sexception(type, lp, msg);
 414  414  
 415  415          return (exception);
 416  416  }
 417  417  
 418  418  extern "C" nvlist_t *
 419      -v8plus_call(v8plus_jsfunc_t f, const nvlist_t *lp)
      419 +v8plus_call_direct(v8plus_jsfunc_t f, const nvlist_t *lp)
 420  420  {
 421  421          std::unordered_map<uint64_t, cb_hdl_t>::iterator it;
 422  422          const int max_argc = nvlist_length(lp);
 423  423          int argc, err;
 424  424          v8::Handle<v8::Value> argv[max_argc];
 425  425          v8::Handle<v8::Value> res;
 426  426          nvlist_t *rp;
 427  427  
 428  428          if ((it = cbhash.find(f)) == cbhash.end())
 429  429                  v8plus_panic("callback hash tag %llu not found", f);
↓ open down ↓ 89 lines elided ↑ open up ↑
 519  519  
 520  520          if (!it->second.ch_persist) {
 521  521                  pfh = v8::Persistent<v8::Function>::New(it->second.ch_hdl);
 522  522                  it->second.ch_hdl = pfh;
 523  523                  it->second.ch_persist = _B_TRUE;
 524  524          }
 525  525          ++it->second.ch_refs;
 526  526  }
 527  527  
 528  528  extern "C" void
 529      -v8plus_jsfunc_rele(v8plus_jsfunc_t f)
      529 +v8plus_jsfunc_rele_direct(v8plus_jsfunc_t f)
 530  530  {
 531  531          v8::Local<v8::Function> lfh;
 532  532          std::unordered_map<uint64_t, cb_hdl_t>::iterator it;
 533  533  
 534  534          if ((it = cbhash.find(f)) == cbhash.end())
 535  535                  v8plus_panic("callback hash tag %llu not found", f);
 536  536  
 537  537          if (it->second.ch_refs == 0)
 538  538                  v8plus_panic("releasing unheld callback hash tag %llu", f);
 539  539  
↓ open down ↓ 93 lines elided ↑ open up ↑
 633  633  }
 634  634  
 635  635  extern "C" void
 636  636  v8plus_obj_hold(const void *cop)
 637  637  {
 638  638          v8plus::ObjectWrap *op = v8plus::ObjectWrap::objlookup(cop);
 639  639          op->public_Ref();
 640  640  }
 641  641  
 642  642  extern "C" void
 643      -v8plus_obj_rele(const void *cop)
      643 +v8plus_obj_rele_direct(const void *cop)
 644  644  {
 645  645          v8plus::ObjectWrap *op = v8plus::ObjectWrap::objlookup(cop);
 646  646          op->public_Unref();
 647  647  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX