summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2019-09-29 15:17:06 +0200
committerJose <jose@zeroc.com>2019-09-29 15:17:06 +0200
commitc5a456b2d1a13bf58a2d702d26ee55f705d4f42c (patch)
treeaade498e658bf2fcfd00c3634355a40384c207dd
parentInrease timeouts in Ice/acm test - Close #558 (diff)
downloadice-c5a456b2d1a13bf58a2d702d26ee55f705d4f42c.tar.bz2
ice-c5a456b2d1a13bf58a2d702d26ee55f705d4f42c.tar.xz
ice-c5a456b2d1a13bf58a2d702d26ee55f705d4f42c.zip
Swift Ice/acm test fixes - Close #535
-rw-r--r--swift/test/Ice/acm/TestI.swift33
1 files changed, 7 insertions, 26 deletions
diff --git a/swift/test/Ice/acm/TestI.swift b/swift/test/Ice/acm/TestI.swift
index e30a60938cf..e7ac4d30b0b 100644
--- a/swift/test/Ice/acm/TestI.swift
+++ b/swift/test/Ice/acm/TestI.swift
@@ -75,29 +75,8 @@ class RemoteObjectAdapterI: RemoteObjectAdapter {
}
class TestI: TestIntf {
- class HearbeatCallbackI {
- let _semaphore: DispatchSemaphore
- var _count: Int32
-
- public init() {
- _count = 0
- _semaphore = DispatchSemaphore(value: 0)
- }
-
- func hearbeat(conn _: Ice.Connection?) {
- _count += 1
- _semaphore.signal()
- }
-
- func waitForCount(count: Int32) {
- while _count < count {
- _semaphore.wait()
- }
- }
- }
-
let _semaphore: DispatchSemaphore
- var _hearbeatCallback: HearbeatCallbackI!
+ var _hearbeatCallback: DispatchSemaphore!
public init() {
_semaphore = DispatchSemaphore(value: 0)
@@ -117,13 +96,15 @@ class TestI: TestIntf {
}
func startHeartbeatCount(current: Current) {
- _hearbeatCallback = HearbeatCallbackI()
- current.con?.setHeartbeatCallback { conn in
- self._hearbeatCallback.hearbeat(conn: conn)
+ _hearbeatCallback = DispatchSemaphore(value: 0)
+ current.con?.setHeartbeatCallback { _ in
+ self._hearbeatCallback.signal()
}
}
func waitForHeartbeatCount(count: Int32, current _: Current) {
- _hearbeatCallback.waitForCount(count: count)
+ for _ in 0..<count {
+ self._hearbeatCallback.wait()
+ }
}
}