File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -80,44 +80,6 @@ def test_busy_timeout
8080 assert time . real *1000 >= 1000
8181 end
8282
83- def test_busy_timeout_holds_gvl
84- work = [ ]
85- Thread . new do
86- while true
87- sleep 0.1
88- work << '.'
89- end
90- end
91- sleep 1
92-
93- @db . busy_timeout 1000
94- busy = Mutex . new
95- busy . lock
96-
97- t = Thread . new do
98- begin
99- db2 = SQLite3 ::Database . open ( "test.db" )
100- db2 . transaction ( :exclusive ) do
101- busy . lock
102- end
103- ensure
104- db2 . close if db2
105- end
106- end
107- sleep 1
108-
109- assert_raises ( SQLite3 ::BusyException ) do
110- work << '>'
111- @db . execute "insert into foo (b) values ( 'from 2' )"
112- end
113-
114- busy . unlock
115- t . join
116-
117- p [ 'busy_timeout' , work ]
118- assert 2 >= work . size - work . find_index ( ">" )
119- end
120-
12183 def test_busy_handler_timeout_releases_gvl
12284 work = [ ]
12385
@@ -155,14 +117,13 @@ def test_busy_handler_timeout_releases_gvl
155117 sleep 1
156118
157119 assert_raises ( SQLite3 ::BusyException ) do
158- work << '> '
120+ work << '| '
159121 @db . execute "insert into foo (b) values ( 'from 2' )"
160122 end
161123
162124 busy . unlock
163125 t . join
164126
165- p [ 'busy_handler_timeout' , work ]
166- assert 2 < work . size - work . find_index ( ">" )
127+ assert work . size - work . find_index ( '|' ) > 3
167128 end
168129end
You can’t perform that action at this time.
0 commit comments