Post

Replies

Boosts

Views

Created

Does the block of xpc_connection_set_event_handler need sync to avoid race condition?
I ran a test code with ThreadSanitizer, it throws a race condition in the block of xpcconnectionseteventhandler even I set a sync queue to the connection. xpc_connection_set_event_handler(conn, ^(xpc_object_t event) { xpc_type_t type = xpc_get_type(event); if (xpc_get_type(event) == XPC_TYPE_DICTIONARY) { 		// race condition here 		// WARNING: ThreadSanitizer: data race // ... } else { if (event == XPCERRORCONNECTIONINVALID) { // Error indicates the peer has closed the connection. // Tear down any associated data structures. } else { // Error indicates that service will terminate soon. // Flush all buffers, finish all work, etc. } xpcrelease(peer); } }); https://developer.apple.com/documentation/xpc/1448786-xpc_connection_set_target_queue?language=objc: "the XPC runtime guarantees that, when the target queue is a serial queue, the event handler block will execute synchronously with respect to other blocks submitted to that same queue. When the target queue is a concurrent queue, the event handler block may run concurrently with other blocks submitted to that queue, but it will never run concurrently with other invocations of itself for the same connection" looks like there should have no race condition according to the above description, but why I encounter the race condition issue reported by ThreadSanitizer? Does the block of xpcconnectionseteventhandler need sync to avoid race condition?
0
0
757
Dec ’20
How to set environment variables for system extension
Hi Experts, I knew there is LSEnvironment for defining environment variables to be set before launching. e.g. <key>LSEnvironment</key> <dict> <key>PATH</key> <string>/Users/flori/.rvm/gems/ruby-1.9.3-p362/bin:/Users/flori/.rvm/gems/ruby-1.9.3-p362@global/bin:/Users/flori/.rvm/rubies/ruby-1.9.3-p326/bin:/Users/flori/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:</string> </dict> How about system extension? Thanks a lot.
2
0
1.7k
Dec ’20
com.apple.networkextension.filter-packet does not work
Hi,I downloaded FilteringNetworkTraffic and added a FilterPacketProvider to intercept network packet with following info.plist:&amp;lt;key&amp;gt;NEProviderClasses&amp;lt;/key&amp;gt; &amp;lt;dict&amp;gt; &amp;lt;key&amp;gt;com.apple.networkextension.filter-packet&amp;lt;/key&amp;gt; &amp;lt;string&amp;gt;$(PRODUCT_MODULE_NAME).FilterPacketProvider&amp;lt;/string&amp;gt; &amp;lt;/dict&amp;gt;but the callback function and packetHandler closure do not work at all? thanks!
12
0
3k
Jan ’20