File tree Expand file tree Collapse file tree
Service/Tests/FunctionalTests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,9 +67,16 @@ - (instancetype)initWithHandlerQueue:(dispatch_queue_t)handlerQueue {
6767 if (self) {
6868 // For internal IO and event handlers, it is equivalent to creating it as a serial queue as they
6969 // are not reentrant and only one block will be scheduled by dispatch io and dispatch source.
70- _handlerQueue =
71- handlerQueue
72- ?: dispatch_queue_create (" com.google.edo.socketChannel.handler" , DISPATCH_QUEUE_SERIAL);
70+ if (handlerQueue) {
71+ _handlerQueue = handlerQueue;
72+ } else {
73+ // Use QOS_CLASS_USER_INITIATED as the default because eDO communication is often in the
74+ // critical path of user-driven test execution, and using a lower QoS can lead to priority
75+ // inversion issues.
76+ dispatch_queue_attr_t attributes = dispatch_queue_attr_make_with_qos_class (
77+ DISPATCH_QUEUE_SERIAL, QOS_CLASS_USER_INITIATED, 0 );
78+ _handlerQueue = dispatch_queue_create (" com.google.edo.socketChannel.handler" , attributes);
79+ }
7380 }
7481 return self;
7582}
Original file line number Diff line number Diff line change @@ -156,7 +156,7 @@ - (void)testBlockResolveToLocalAddress {
156156
157157 // Sending block to remote process through background eDO host.
158158 dispatch_sync (backgroundQueue, ^{
159- pthread_set_qos_class_self_np (QOS_CLASS_DEFAULT , 0 );
159+ pthread_set_qos_class_self_np (QOS_CLASS_USER_INITIATED , 0 );
160160 remoteDummy.block = localBlock;
161161 });
162162
Original file line number Diff line number Diff line change @@ -226,7 +226,7 @@ - (void)testTemporaryServiceHandlesRecursiveCall {
226226 EDOTestDummy *remoteDummy = [EDOClientService rootObjectWithPort: EDOTEST_APP_SERVICE_PORT];
227227 // Align QoS with eDO internal threads to avoid priority inversion.
228228 dispatch_queue_attr_t attr =
229- dispatch_queue_attr_make_with_qos_class (DISPATCH_QUEUE_SERIAL, QOS_CLASS_DEFAULT , 0 );
229+ dispatch_queue_attr_make_with_qos_class (DISPATCH_QUEUE_SERIAL, QOS_CLASS_USER_INITIATED , 0 );
230230 dispatch_queue_t testQueue = dispatch_queue_create (" com.google.edotest" , attr);
231231
232232 XCTestExpectation *expectation = [self expectationWithDescription: @" recursive call completes." ];
You can’t perform that action at this time.
0 commit comments