Hello, I am going to use endpoint security framework in my application. Unfortunately, I have not found any clear cut explanation about how to use endpoint security in multithread applications.
- Can we say the handler block (es_handler_block_t), which is the parameter of es_new_client(), is running in separate thread?
- Does es_new_client() create new thread?
- Should I synchronize a handler block and the code which calls es_delete_client()? Should I protect the handler block by mutex?
Thank you in advance.
I am going to use endpoint security framework in my application.
To be clear, ES clients are not applications. You have two choices:
-
An ES system extension
-
A
launchd
daemon that calls ES
Regarding your first two questions, when you call es_new_client
the system calls the supplied block from a custom serialised context that it manages.
Regarding your third question, many ES clients never call es_delete_client
because they run indefinitely. However, if you do call it then, as the doc comments make clear, you must call it from the same thread that called es_new_client
. Most folks do both of these from the main thread.
IMPORTANT Because of these constraints, es_delete_client
inherently races with event delivery.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"