mirror of
https://github.com/rubyjs/therubyracer
synced 2023-03-27 23:21:42 -04:00
don't run thread specs as part of the CI build.
This commit is contained in:
parent
ea061df1de
commit
3c6c0c5a5d
2 changed files with 30 additions and 2 deletions
2
Rakefile
2
Rakefile
|
@ -16,7 +16,7 @@ end
|
||||||
|
|
||||||
require 'rspec/core/rake_task'
|
require 'rspec/core/rake_task'
|
||||||
RSpec::Core::RakeTask.new(:spec) do |task|
|
RSpec::Core::RakeTask.new(:spec) do |task|
|
||||||
task.rspec_opts = '--tag ~memory'
|
task.rspec_opts = '--tag ~memory --tag ~threads'
|
||||||
end
|
end
|
||||||
|
|
||||||
task :sanity => [:clean, :compile] do
|
task :sanity => [:clean, :compile] do
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe "using v8 from multiple threads" do
|
describe "using v8 from multiple threads", :threads => true do
|
||||||
|
|
||||||
it "creates contexts from within threads" do
|
it "creates contexts from within threads" do
|
||||||
10.times.collect do
|
10.times.collect do
|
||||||
|
@ -21,4 +21,32 @@ describe "using v8 from multiple threads" do
|
||||||
end
|
end
|
||||||
end.each {|t| t.join}
|
end.each {|t| t.join}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "can access the current thread id" do
|
||||||
|
V8::C::Locker() do
|
||||||
|
V8::C::V8::GetCurrentThreadId().should_not be_nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it "can pre-empt a running JavaScript thread" do
|
||||||
|
pending "need to release the GIL while executing V8 code"
|
||||||
|
begin
|
||||||
|
V8::C::Locker::StartPreemption(2)
|
||||||
|
thread_id = nil
|
||||||
|
Thread.new do
|
||||||
|
loop until thread_id
|
||||||
|
puts "thread id: #{thread_id}"
|
||||||
|
V8::C::V8::TerminateExecution(thread_id)
|
||||||
|
end
|
||||||
|
Thread.new do
|
||||||
|
V8::C::Locker() do
|
||||||
|
thread_id = V8::C::V8::GetCurrentThreadId()
|
||||||
|
V8::Context.new {|cxt| cxt.eval('while (true) {}')}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
V8::C::V8::TerminateExecution(thread_id)
|
||||||
|
ensure
|
||||||
|
V8::C::Locker::StopPreemption()
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
Loading…
Reference in a new issue