diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2012-01-05 01:02:59 +0100 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2012-01-06 00:42:55 +0100 |
commit | dadc30318f812587405dd58d9a5d10ce392710b3 (patch) | |
tree | 4157f05ce5e90f88663c15f796fc4b2b9d7088e1 /src/node_internals.h | |
parent | 075acfa2d6c823ec9ccedba5fdbca172752d1e4a (diff) | |
download | android-node-v8-dadc30318f812587405dd58d9a5d10ce392710b3.tar.gz android-node-v8-dadc30318f812587405dd58d9a5d10ce392710b3.tar.bz2 android-node-v8-dadc30318f812587405dd58d9a5d10ce392710b3.zip |
isolates: implement message passing
Parent and child isolates can now pass arbitrary binary messages between each
other. The messages are sent and received through a thread-safe queue that
wakes up the event loop of the receiving thread.
Diffstat (limited to 'src/node_internals.h')
-rw-r--r-- | src/node_internals.h | 58 |
1 files changed, 6 insertions, 52 deletions
diff --git a/src/node_internals.h b/src/node_internals.h index 08dbcb1f43..11dc8fa3a9 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -47,59 +47,13 @@ void StartThread(Isolate* isolate, int argc, char** argv); #define ARRAY_SIZE(a) (sizeof((a)) / sizeof((a)[0])) #endif -// -// isolates support -// -#if HAVE_ISOLATES - -# if _WIN32 -# define THREAD __declspec(thread) -# else -# define THREAD __thread -# endif - -# define TLS(type, name) THREAD type* __tls_##name -# define VAR(name) (*__tls_##name) -# define EMPTY(name) (__tls_##name == NULL) -# define ASSIGN(name, val) ((__tls_##name) = P(val)) - -# define LAZY_ASSIGN(name, val) \ - do if (!__tls_##name) ((__tls_##name) = P(val)); while (0) - -template <class T> inline v8::Persistent<T>* P(v8::Handle<T> v) -{ - return new v8::Persistent<T>(v8::Persistent<T>::New(v)); -} - -inline v8::Persistent<v8::String>* P(const char* symbol) -{ - return new v8::Persistent<v8::String>( - v8::Persistent<v8::String>::New( - v8::String::NewSymbol(symbol))); -} - -#else // !HAVE_ISOLATES - -# define THREAD /* nothing */ -# define TLS(type, name) type name -# define VAR(name) (name) -# define EMPTY(name) ((name).IsEmpty()) -# define ASSIGN(name, val) ((name) = P(val)) - -# define LAZY_ASSIGN(name, val) \ - do if ((name).IsEmpty()) (name) = P(val); while (0) - -template <class T> inline v8::Persistent<T> P(v8::Handle<T> v) -{ - return v8::Persistent<T>(v); -} +#define DISALLOW_COPY_AND_ASSIGN(TypeName) \ + TypeName(const TypeName&); \ + void operator=(const TypeName&) -inline v8::Persistent<v8::String> P(const char* symbol) -{ - return v8::Persistent<v8::String>::New( - v8::String::NewSymbol(symbol)); -} -#endif // HAVE_ISOLATES +#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ + TypeName(); \ + DISALLOW_COPY_AND_ASSIGN(TypeName) } // namespace node |