Cache the thread name
authorJan Vrany <jan.vrany@fit.cvut.cz>
Wed, 12 Jul 2017 16:28:50 +0200
changeset 45 cd9f46746fd1
parent 44 41cc5a7840fe
child 46 6b857f3cec8c
Cache the thread name ...and do no try to fetch it while thread is running.
VDBThreadPresenter.st
--- a/VDBThreadPresenter.st	Thu Jun 08 13:43:34 2017 +0100
+++ b/VDBThreadPresenter.st	Wed Jul 12 16:28:50 2017 +0200
@@ -3,7 +3,7 @@
 "{ NameSpace: Smalltalk }"
 
 VDBModelPresenter subclass:#VDBThreadPresenter
-	instanceVariableNames:'thread'
+	instanceVariableNames:'thread name'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'VDB-Presentation'
@@ -23,9 +23,15 @@
 !
 
 label
-    ^ thread displayString
+    name isNil ifTrue:[ 
+        thread isRunning ifFalse:[
+            name := thread name.
+        ]
+    ].
+    ^ '%1 [%2]' bindWith: (name notNil ifTrue:[name] ifFalse:['thread ' , thread id printString]) with: thread status
 
     "Created: / 22-09-2014 / 00:14:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 12-07-2017 / 14:23:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 thread
@@ -35,9 +41,10 @@
 !VDBThreadPresenter methodsFor:'initialization'!
 
 setThread: aGDBThread
-    thread := aGDBThread
+    thread := aGDBThread.
 
     "Created: / 21-09-2014 / 23:39:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 12-07-2017 / 14:21:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !VDBThreadPresenter methodsFor:'protocol-accessing'!