# HG changeset patch # User Sara # Date 1392494326 28800 # Node ID 83548221c10dff2d4431942309e60b6437bb5003 # Parent 2fcaa90d17fc27a5400e674e0bad680fa90e9200 the first test diff -r 2fcaa90d17fc -r 83548221c10d V8_tests/create_two_context_inside_the_two_threads/ReadMe --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/V8_tests/create_two_context_inside_the_two_threads/ReadMe Sat Feb 15 11:58:46 2014 -0800 @@ -0,0 +1,4 @@ +This is the first test which is; create the C++ strings of the two javascript functions.-] create two "child" threads of the current thread.-] give both threads the same birth function, but pass one string to one, the other string to the other-] inside the birth function:-] create a context, inside the isolate-] set the context active-] compile the string that was passed in-] execute the resulting compiled script-] end the thread. +I expect that to break.. run it a whole bunch of times, if it doesn't.. + +this test works successfully and sometimes gives core dumped, and I captured the output at the screen shoot attached here in this folder. diff -r 2fcaa90d17fc -r 83548221c10d V8_tests/create_two_context_inside_the_two_threads/Test_1.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/V8_tests/create_two_context_inside_the_two_threads/Test_1.cpp Sat Feb 15 11:58:46 2014 -0800 @@ -0,0 +1,92 @@ +#include +#include +using namespace v8; +Isolate* isolate; +//structure that holds thread's paramaters + struct threadParamaters{ +//the string that holds the script to compile it + Handle srcScript; + }; + +void* threadFunction(void* passingParameter){ + if(isolate == NULL){ + printf("Error1"); + return 0; + } + //locks the current isolate, to be used in this thread only + Locker locker1(isolate); + //isolate->Enter(); + //create a new isolate scope for this thread + Isolate::Scope isolate_scope1(isolate);//////////////////try without it + //create new stack-allocated handle-scope + HandleScope handle_scope1(isolate); + //create new context for the current thread + Handle context1 = Context::New(isolate); + //Enters the current context + Context::Scope context_scope1(context1); + //passes the passed paramater to the current thread + struct threadParamaters* p = (struct threadParamaters*) passingParameter; + //compile and hold the compiled thread + Handle