File tree Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ are automatically removed from the pool.
20
20
struct ConnectionPool
21
21
outbox:: Channel
22
22
connections:: Set{AbstractConnection}
23
- condition:: Condition
23
+ condition:: Threads. Condition
24
24
end
25
25
26
26
function ConnectionPool (
@@ -30,7 +30,7 @@ function ConnectionPool(
30
30
pool = ConnectionPool (
31
31
outbox,
32
32
connections,
33
- Condition (),
33
+ Threads . Condition (),
34
34
)
35
35
36
36
# Catch errors here, otherwise they are lost to the void.
@@ -68,12 +68,24 @@ current task until that is the case. Also processes incoming connections.
68
68
"""
69
69
function ensure_connection (pool:: ConnectionPool )
70
70
if isempty (pool. connections)
71
- wait (pool. condition)
71
+ lock (pool. condition)
72
+ try
73
+ wait (pool. condition)
74
+ finally
75
+ unlock (pool. condition)
76
+ end
72
77
end
73
78
end
74
79
75
80
Base. wait (pool:: ConnectionPool ) = ensure_connection (pool)
76
- Base. notify (pool:: ConnectionPool ) = notify (pool. condition)
81
+ function Base. notify (pool:: ConnectionPool )
82
+ lock (pool. condition)
83
+ try
84
+ notify (pool. condition)
85
+ finally
86
+ unlock (pool. condition)
87
+ end
88
+ end
77
89
78
90
"""
79
91
process_messages(pool)
Original file line number Diff line number Diff line change @@ -3,10 +3,6 @@ using Blink
3
3
using Observables
4
4
using Test
5
5
6
- notinstalled = ! AtomShell. isinstalled ()
7
-
8
- notinstalled && AtomShell. install ()
9
-
10
6
"""
11
7
Execute function f() with a timeout of `timeout` seconds. Returns the
12
8
result of f() or `nothing` in the case of a timeout.
@@ -146,5 +142,3 @@ w = open_window()
146
142
body! (w, ExampleRenderableType ())
147
143
@test example_renderable_was_rendered
148
144
end
149
-
150
- notinstalled && AtomShell. uninstall ()
You can’t perform that action at this time.
0 commit comments