Skip to content

Commit

Permalink
Made the isolate used thread_local, which might fix intermittent crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
Martijn Otto committed Nov 3, 2015
1 parent 08f0e0e commit c5f25dc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.o
*.so
*.d
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ LINKER = c++
# with a list of all flags that should be passed to the linker.
#

COMPILER_FLAGS = -Wall -c -O2 -std=c++11 -fpic -DVERSION="`./version.sh`" -I. -g
COMPILER_FLAGS = -Wall -c -O2 -MD -std=c++11 -fpic -DVERSION="`./version.sh`" -I. -g
LINKER_FLAGS = -shared
LINKER_DEPENDENCIES = -lphpcpp -lv8

Expand All @@ -112,6 +112,7 @@ MKDIR = mkdir -p

SOURCES = $(wildcard *.cpp)
OBJECTS = $(SOURCES:%.cpp=%.o)
DEPENDENCIES = $(SOURCES:%.cpp=%.d)


#
Expand All @@ -120,6 +121,11 @@ OBJECTS = $(SOURCES:%.cpp=%.o)

all: ${OBJECTS} ${EXTENSION}

#
# Use dependency tracking
#
-include ${DEPENDENCIES}

${EXTENSION}: ${OBJECTS}
${LINKER} ${LINKER_FLAGS} -o $@ ${OBJECTS} ${LINKER_DEPENDENCIES}

Expand Down
4 changes: 2 additions & 2 deletions isolate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ class Isolate final
*/
v8::Isolate* isolate()
{
// the one and only isolate
static Isolate isolate;
// the one and only isolate in this thread
static thread_local Isolate isolate;

// cast it to the right type
return isolate;
Expand Down

0 comments on commit c5f25dc

Please sign in to comment.