File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed
stdlib/public/SDK/Dispatch Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -232,11 +232,13 @@ public extension DispatchQueue {
232
232
{
233
233
var result : T ?
234
234
var error : Error ?
235
- fn {
236
- do {
237
- result = try work ( )
238
- } catch let e {
239
- error = e
235
+ withoutActuallyEscaping ( work) { _work in
236
+ fn {
237
+ do {
238
+ result = try _work ( )
239
+ } catch let e {
240
+ error = e
241
+ }
240
242
}
241
243
}
242
244
if let e = error {
Original file line number Diff line number Diff line change @@ -40,6 +40,13 @@ DispatchAPI.test("DispatchGroup creation") {
40
40
expectNotNil ( group)
41
41
}
42
42
43
+ DispatchAPI . test ( " Dispatch sync return value " ) {
44
+ let value = 24 ;
45
+ let q = DispatchQueue ( label: " Test " )
46
+ let result = q. sync ( ) { return 24 }
47
+ expectEqual ( value, result)
48
+ }
49
+
43
50
DispatchAPI . test ( " dispatch_block_t conversions " ) {
44
51
var counter = 0
45
52
let closure = { ( ) -> Void in
You can’t perform that action at this time.
0 commit comments