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 {
457457 case . timedOut:
458458 /// We timed out waiting for the response. Any following requests would
459459 /// 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 ( )
463464 throw SourceKitError . timedOut ( request: info)
464465 }
465466 }
Original file line number Diff line number Diff line change @@ -83,19 +83,15 @@ public class SourceKitdService {
8383 sourcekitd_shutdown ( )
8484 }
8585
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
8787 /// we time out waiting for a request response and we want to handle it.
8888 /// Replace by proper cancellation once we have cancellation support in
8989 /// 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)
9793 stateQueue. sync {
98- self . state = . running
94+ self . state = . interrupted
9995 }
10096 }
10197
You can’t perform that action at this time.
0 commit comments