Okay, cannot actually share the code right here. Perhaps I must sandbox this.
So I am calling begin/stopAccessingSecurityScopedResource twice in a row from totally different threads. Placing them on the identical thread does not repair it, the calls by no means overlap within the debugger – they’re all the time consecutive. I am simply getting an inventory of information within the listing each instances.
Each time I name it the primary time, it succeeds. Even operating the identical occasion within the debugger and by no means shutting down this system. The second time I name it it all the time fails. So:
begin debugging
attempt the operation
succeed fail
attempt once more
succeed fail
attempt once more
succeed fail
cease debugging
I’ve tried sleeps, calling each calls to start out from the identical thread, I’ve manually managed the calls matching them to information guaranteeing that cease accessing is rarely known as whereas one other a part of this system continues to be utilizing it. I do not perceive why if it fails the second time (I’ve seen some folks have this difficulty) it then proceeds to work once more the primary name in the identical run occasion. I’ve checked different elements of the code to see if we’re calling stopAccessing in another place I am not conscious of.
Is there some type of international reset for safe information, some type of timing difficulty for startAccessingSecurityScopedResource?
I’ve seen different Stack Overflow solutions principally asking the identical query, however these solutions appear… lower than skilled. Simply go away entry open indefinately, thus in accordance with documentation leak kernal sources?