Print this page
enable v8plus_call to be used in any thread

Split Close
Expand all
Collapse all
          --- old/./v8plus_glue.h
          +++ new/./v8plus_glue.h
↓ open down ↓ 104 lines elided ↑ open up ↑
 105  105   * mechanism for creating a JS function from C.  It can however be used to
 106  106   * return a function (or object containing one, etc.) from a deferred
 107  107   * completion routine in which a JS function has been invoked that returned
 108  108   * such a thing to us.
 109  109   */
 110  110  extern int nvlist_lookup_v8plus_jsfunc(const nvlist_t *, const char *,
 111  111      v8plus_jsfunc_t *);
 112  112  extern int nvpair_value_v8plus_jsfunc(const nvpair_t *, v8plus_jsfunc_t *);
 113  113  extern void v8plus_jsfunc_hold(v8plus_jsfunc_t);
 114  114  extern void v8plus_jsfunc_rele(v8plus_jsfunc_t);
      115 +extern void v8plus_jsfunc_rele_direct(v8plus_jsfunc_t);
 115  116  
 116  117  /*
 117  118   * Place or release a hold on the V8 representation of the specified C object.
 118  119   * This is rarely necessary; v8plus_defer() performs this action for you, but
 119  120   * other asynchronous mechanisms may require it.  If you are returning from
 120  121   * a method call but have stashed a reference to the object somewhere and are
 121  122   * not calling v8plus_defer(), you must call this first.  Holds and releases
 122  123   * must be balanced.  Use of the object within a thread after releasing is a
 123  124   * bug.
 124  125   */
 125  126  extern void v8plus_obj_hold(const void *);
 126  127  extern void v8plus_obj_rele(const void *);
      128 +extern void v8plus_obj_rele_direct(const void *);
 127  129  
 128  130  /*
 129  131   * Convenience functions for dealing with JS arguments.
 130  132   */
 131  133  extern v8plus_type_t v8plus_typeof(const nvpair_t *);
 132  134  extern int v8plus_args(const nvlist_t *, uint_t, v8plus_type_t t, ...);
 133  135  extern nvlist_t *v8plus_obj(v8plus_type_t, ...);
 134  136  extern int v8plus_obj_setprops(nvlist_t *, v8plus_type_t, ...);
 135  137  
 136  138  /*
↓ open down ↓ 10 lines elided ↑ open up ↑
 147  149  typedef void (*v8plus_completion_f)(void *, void *, void *);
 148  150  
 149  151  extern void v8plus_defer(void *, void *, v8plus_worker_f, v8plus_completion_f);
 150  152  
 151  153  /*
 152  154   * Call an opaque JavaScript function from C.  The caller is responsible for
 153  155   * freeing the returned list.  The first argument is not const because it is
 154  156   * possible for the JS code to modify the function represented by the cookie.
 155  157   */
 156  158  extern nvlist_t *v8plus_call(v8plus_jsfunc_t, const nvlist_t *);
      159 +extern nvlist_t *v8plus_call_direct(v8plus_jsfunc_t, const nvlist_t *);
 157  160  
 158  161  /*
 159  162   * Call the named JavaScript function in the context of the JS object
 160  163   * represented by the native object.  Calling and return conventions are the
 161  164   * same as for the C interfaces; i.e., the nvlist will be converted into JS
 162  165   * objects and the return value or exception will be in the "res" or "err"
 163  166   * members of the nvlist that is returned, respectively.  If an internal
 164  167   * error occurs, NULL is returned and _v8plus_errno set accordingly.  The
 165  168   * results of calling a method implemented in C via this interface are
 166  169   * undefined.
↓ open down ↓ 51 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX