File tree Expand file tree Collapse file tree 2 files changed +9
-12
lines changed
SourceKitStressTester/Sources Expand file tree Collapse file tree 2 files changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -457,9 +457,10 @@ class SourceKitDocument {
457
457
case . timedOut:
458
458
/// We timed out waiting for the response. Any following requests would
459
459
/// not be executed by SourceKit until this one finishes. To avoid this,
460
- /// and since we don't have cancellation support in SourceKit, set up a
461
- /// new connection that is free to execute requests.
462
- connection. restart ( )
460
+ /// and since we don't have cancellation support in SourceKit, crash the
461
+ /// current SourceKitService so we get a new instance that isn't
462
+ /// processing any requests.
463
+ connection. crash ( )
463
464
throw SourceKitError . timedOut ( request: info)
464
465
}
465
466
}
Original file line number Diff line number Diff line change @@ -83,19 +83,15 @@ public class SourceKitdService {
83
83
sourcekitd_shutdown ( )
84
84
}
85
85
86
- /// Restarts the service. This is a workaround to set up a new service in case
86
+ /// Crash the service. This is a workaround to set up a new service in case
87
87
/// we time out waiting for a request response and we want to handle it.
88
88
/// Replace by proper cancellation once we have cancellation support in
89
89
/// SourceKit.
90
- public func restart( ) {
91
- sourcekitd_shutdown ( )
92
- // We need to wait for the old service to fully shut down before we can
93
- // create a new one but we don't receive a notification when the old service
94
- // did shut down. Waiting for a second seems to give it enough time.
95
- sleep ( 1 )
96
- initializeService ( )
90
+ public func crash( ) {
91
+ let request = SourceKitdRequest ( uid: . request_CrashWithExit)
92
+ _ = sourcekitd_send_request_sync ( request. rawRequest)
97
93
stateQueue. sync {
98
- self . state = . running
94
+ self . state = . interrupted
99
95
}
100
96
}
101
97
You can’t perform that action at this time.
0 commit comments