NEFilterControlProvider thread safety

So are instances of NEFilterControlProvider (or more accurately instances of subclasses) thread safe, particularly the handleNewFlow() method? Also, are there more than one instance of NEFilterControlProvider alive at any one time? log messages seem to indicate that there are. What I'm really trying to figure out is the lifecycle of these objects, if that makes sense.


Thanks in advance!

Accepted Reply

What do you mean by “thread safe”? With regards the

-handleNewFlow:completionHandler:
method, that’s a method that you implement, so its thread safeness is determined by how you implement it.

I suspect you’re asking whether

-handleNewFlow:completionHandler:
has any constraints on how it’s called, that is, does the system guarantee to call this method on a specific thread or queue, or provide any other serialisation guarantee. And the answer to that is that it does not. If you need to serialise this work, you must do that yourself.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Replies

What do you mean by “thread safe”? With regards the

-handleNewFlow:completionHandler:
method, that’s a method that you implement, so its thread safeness is determined by how you implement it.

I suspect you’re asking whether

-handleNewFlow:completionHandler:
has any constraints on how it’s called, that is, does the system guarantee to call this method on a specific thread or queue, or provide any other serialisation guarantee. And the answer to that is that it does not. If you need to serialise this work, you must do that yourself.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"