Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ce1d0f1

Browse files
Update test.
1 parent 1b2d648 commit ce1d0f1

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

‎SQLiteTests/ConnectionTests.swift‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,19 +320,22 @@ class ConnectionTests : SQLiteTestCase {
320320
try! conn.run("INSERT INTO test(value) VALUES(?)", 0)
321321

322322
let q = dispatch_queue_create("Readers", DISPATCH_QUEUE_CONCURRENT);
323-
var finished = false
324323

325-
for _ in 0..<100 {
324+
var reads = [0, 0, 0, 0, 0]
325+
var finished = false
326+
for index in 0..<5 {
326327
dispatch_async(q) {
327328
while !finished {
328329
_ = try! conn.prepare("SELECT value FROM test")
330+
reads[index] += 1
329331
}
330332
}
331333
}
332334

333-
// Give the threads some time to conflict
334-
sleep(5)
335-
finished = true
335+
while !finished {
336+
sleep(1)
337+
finished = reads.reduce(true) { 0ドル && (1ドル > 500) }
338+
}
336339
}
337340

338341
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /