@@ -222,6 +222,8 @@ static std::string getDiagnosticDocumentationPath() {
222
222
return path.str ().str ();
223
223
}
224
224
225
+ static dispatch_queue_t msgHandlingQueue;
226
+
225
227
static void sourcekitdServer_peer_event_handler (xpc_connection_t peer,
226
228
xpc_object_t event) {
227
229
xpc_type_t type = xpc_get_type (event);
@@ -245,8 +247,7 @@ static void sourcekitdServer_peer_event_handler(xpc_connection_t peer,
245
247
assert (type == XPC_TYPE_DICTIONARY);
246
248
// Handle the message
247
249
xpc_retain (event);
248
- dispatch_async (dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT,0 ),
249
- ^{
250
+ dispatch_async (msgHandlingQueue, ^{
250
251
xpc_object_t contents = xpc_dictionary_get_value (event, " msg" );
251
252
252
253
if (!contents) {
@@ -324,7 +325,7 @@ static void sourcekitdServer_event_handler(xpc_connection_t peer) {
324
325
// you can defer this call until after that initialization is done.
325
326
xpc_connection_resume (peer);
326
327
327
- dispatch_async ( dispatch_get_main_queue () , ^{
328
+ dispatch_barrier_async (msgHandlingQueue , ^{
328
329
getInitializationInfo (MainConnection);
329
330
});
330
331
}
@@ -368,6 +369,10 @@ int main(int argc, const char *argv[]) {
368
369
LOG_WARN_FUNC (" getrlimit failed: " << llvm::sys::StrError ());
369
370
}
370
371
372
+ auto attr = dispatch_queue_attr_make_with_qos_class (DISPATCH_QUEUE_CONCURRENT,
373
+ QOS_CLASS_DEFAULT, 0 );
374
+ msgHandlingQueue = dispatch_queue_create (" request-handling" , attr);
375
+
371
376
xpc_main (sourcekitdServer_event_handler);
372
377
return 0 ;
373
378
}
0 commit comments