summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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()
+ }
}
}