Print this page
XXX keith II

@@ -11,10 +11,12 @@
 
 #ifdef  __cplusplus
 extern "C" {
 #endif  /* __cplusplus */
 
+#define __UNUSED        __attribute__((__unused__))
+
 #define V8PLUS_ARG_F_NOEXTRA    0x01
 
 #define V8PLUS_ERRMSG_LEN       512
 #define V8PLUS_JSF_COOKIE       ".__v8plus_jsfunc_cookie"
 

@@ -161,14 +163,24 @@
  * members of the nvlist that is returned, respectively.  If an internal
  * error occurs, NULL is returned and _v8plus_errno set accordingly.  The
  * results of calling a method implemented in C via this interface are
  * undefined.
  *
- * This can be used in concert with JS code to emit events asynchronously;
- * see the documentation.
+ * These methods can be used in concert with JS code to emit events
+ * asynchronously; see the documentation.
+ *
+ * Note: As JavaScript functions must be called from the event loop thread,
+ * v8plus_method_call() contains logic to determine whether we are in the
+ * correct context or not.  If we are running on some other thread we will
+ * queue the request and sleep, waiting for the event loop thread to make the
+ * call.  In the simple case, where we are already in the correct thread,
+ * we make the call directly.  v8plus_method_call_direct() assumes we are
+ * on the correct thread and always makes the call directly.
  */
 extern nvlist_t *v8plus_method_call(void *, const char *, const nvlist_t *);
+extern nvlist_t *v8plus_method_call_direct(void *, const char *,
+    const nvlist_t *);
 
 /*
  * These methods are analogous to strerror(3c) and similar functions; they
  * translate among error names, codes, and default messages.  There is
  * normally little need for these functions in C methods, as everything

@@ -190,10 +202,16 @@
 extern const v8plus_method_descr_t v8plus_methods[];
 extern const uint_t v8plus_method_count;
 extern const v8plus_static_descr_t v8plus_static_methods[];
 extern const uint_t v8plus_static_method_count;
 
+/*
+ * Private methods.
+ */
+extern boolean_t v8plus_in_event_thread(void);
+extern void v8plus_crossthread_init(void);
+
 #ifdef  __cplusplus
 }
 #endif  /* __cplusplus */
 
 #endif  /* _V8PLUS_GLUE_H */