Post

Replies

Boosts

Views

Activity

Avoiding the race between pause() verdict and resumeFlow()
Hello, Is there a way to avoid a possible race between pausing and resuming the flow in the following example? class FilterDataProvider: NEFilterDataProvider {    override func handleNewFlow(_ flow: NEFilterFlow) -> NEFilterNewFlowVerdict { 		 /* this block is submitted for async processing */ { 				 let verdict: NEFilterNewFlowVerdict = self.makeDecision(flow) ? .allow() : .drop()          self.resumeFlow(flow, with: verdict) 		 } 		 return .pause() 	} } Since the flow is paused after the handleNewFlow() function returns, it seems impossible to ensure that resumeFlow() is called after the flow is actually paused. Is there any suggested way of avoiding this race? Thanks
9
0
1.2k
Nov ’21
Avoiding the race between pause() verdict and resumeFlow()
Hello, Is there a way to avoid a possible race between pausing and resuming the flow in the following example? class FilterDataProvider: NEFilterDataProvider {    override func handleNewFlow(_ flow: NEFilterFlow) -> NEFilterNewFlowVerdict { 		 /* this block is submitted for async processing */ { 				 let verdict: NEFilterNewFlowVerdict = self.makeDecision(flow) ? .allow() : .drop()          self.resumeFlow(flow, with: verdict) 		 } 		 return .pause() 	} } Since the flow is paused after the handleNewFlow() function returns, it seems impossible to ensure that resumeFlow() is called after the flow is actually paused. Is there any suggested way of avoiding this race? Thanks
Replies
9
Boosts
0
Views
1.2k
Activity
Nov ’21