Skip to content

Commit

Permalink
Add interrupt support on the client side [feenkcom/gtoolkit#3942]
Browse files Browse the repository at this point in the history
  • Loading branch information
chisandrei committed Aug 22, 2024
1 parent f713059 commit 78ed67a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,21 @@ GtGemStoneAsyncEvaluationElement >> gtActionCancelExecutionFor: anAction [
promiseResolution stopEvaluation ].
]

{ #category : #'gt - actions' }
GtGemStoneAsyncEvaluationElement >> gtActionDebugExecutionFor: anAction [
<gtExecutionAction>

promiseResolution canStopExecution ifFalse: [ ^ anAction empty ].

^ anAction button
label: 'Debug';
priority: 110;
icon: BrGlamorousVectorIcons debug;
tooltip: 'Debug the execution';
action: [ :button |
promiseResolution interruptEvaluation ].
]

{ #category : #'gt - actions' }
GtGemStoneAsyncEvaluationElement >> gtActionInspectResolvedValueFor: anAction [
<gtExecutionAction>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ GtGemStoneSnippetPromise >> initialize [
state := #PendingResolution.
]

{ #category : #actions }
GtGemStoneSnippetPromise >> interruptEvaluation [
self assert: [ executionContext notNil ].

^ executionContext interruptAsyncComputation
]

{ #category : #testing }
GtGemStoneSnippetPromise >> isBroken [
"Report if the receiver is currently broken"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ GtGemStoneSnippetPromiseResolution >> initialize [
state := #'Not Started'
]

{ #category : #actions }
GtGemStoneSnippetPromiseResolution >> interruptEvaluation [
snippetPromise interruptEvaluation
]

{ #category : #testing }
GtGemStoneSnippetPromiseResolution >> isResolutionProcessDone [
^ resolutionProcess isTerminated or: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ GtpoGtGemStoneEvaluationContext class >> remoteClassName [
^ #GtGemStoneEvaluationContext
]

{ #category : #'actions - debug' }
GtpoGtGemStoneEvaluationContext >> interruptAsyncComputation [

^ self proxyPerform: #interruptAsyncComputation
]

{ #category : #accessing }
GtpoGtGemStoneEvaluationContext >> printOn: aStream [
"Avoid a GS call that is typically only written to PharoDebug.log"
Expand Down

0 comments on commit 78ed67a

Please sign in to comment.