[PATCH] D48562: [clangd] XPC transport layer
Alex Lorenz via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 13 14:32:52 PDT 2018
arphaman added inline comments.
Herald added a subscriber: dexonsmith.
================
Comment at: xpc/test-client/ClangdXPCTestClient.cpp:51
+ dlHandle, "clangd_xpc_get_bundle_identifier");
+ xpc_connection_t conn =
+ xpc_connection_create(clangd_xpc_get_bundle_identifier(), NULL);
----------------
jkorous wrote:
> arphaman wrote:
> > We should probably use the main queue here too to ensure that we don't get bit by concurrent handler invocations.
> As far as I understand it this is taken care of by calling dispatch_main().
>
> Per man dispatch_main:
> "MAIN QUEUE
> [...]
> Programs must call dispatch_main() at the end of main() in order to process blocks submitted to the main queue."
>
Not really. The documentation for the parameter states the following:
The GCD queue to which the event handler block will be submitted. This parameter may be NULL, in which case the connection's target queue will be libdispatch's default target queue, defined as DISPATCH_TARGET_QUEUE_DEFAULT. The target queue may be changed later with a call to xpc_connection_set_target_queue().
So the handler blocks will be submitted to the concurrent queue (DISPATCH_TARGET_QUEUE_DEFAULT) which means that they might end up running concurrently.
https://reviews.llvm.org/D48562
More information about the cfe-commits
mailing list