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.
2020struct ConnectionPool
2121 outbox:: Channel
2222 connections:: Set{AbstractConnection}
23- condition:: Condition
23+ condition:: Threads. Condition
2424end
2525
2626function ConnectionPool (
@@ -30,7 +30,7 @@ function ConnectionPool(
3030 pool = ConnectionPool (
3131 outbox,
3232 connections,
33- Condition (),
33+ Threads . Condition (),
3434 )
3535
3636 # 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.
6868"""
6969function ensure_connection (pool:: ConnectionPool )
7070 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
7277 end
7378end
7479
7580Base. 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
7789
7890"""
7991 process_messages(pool)
Original file line number Diff line number Diff line change @@ -3,10 +3,6 @@ using Blink
33using Observables
44using Test
55
6- notinstalled = ! AtomShell. isinstalled ()
7-
8- notinstalled && AtomShell. install ()
9-
106"""
117Execute function f() with a timeout of `timeout` seconds. Returns the
128result of f() or `nothing` in the case of a timeout.
@@ -146,5 +142,3 @@ w = open_window()
146142 body! (w, ExampleRenderableType ())
147143 @test example_renderable_was_rendered
148144end
149-
150- notinstalled && AtomShell. uninstall ()
You can’t perform that action at this time.
0 commit comments