��
Le 2017-09-25 12:21, jtuchel@objektfabrik.de wrote :
Steven
You��could��add��use��a��semaphore��if��changing��code��is��an��option.
We once used MethodWrappers in VAST to answer a similar question regarding whether a body of code can be removed from a system.
Joachim��
This is exactly my usecase, i need to remove code that may be called by a method on the stack - and i know exactly which method. However my base hypothesis is that it is in an already running process (maybe a loop) and that part i cannot change. Is there an existing Pharo implementation of MethodWrappers ?
��
Le 2017-09-25 14:32, Ben Coman wrote :
I'm not sure if your wanting something more built in, or just "some way",so for the latter, consider wrapping in with your own status flags...��status := #setup.watcher := [[true] whileTrue:[��Transcript crShow: status.��900 milliSeconds wait]] forkAt:36.result := 0.worker := [[true] whileTrue:[��status := #WORKING.��1 second wait.result := result + 1.��Transcript crShow: result.��status:=#waiting.��3 seconds wait]] forkAt:35.worker suspend.worker resume.��cheers -ben����I want to avoid adding control in the code, because hypothetically the process i want to check is already running and possibly written by somebody else. I've think about a similar solution using metalinks, but if the loop is on the stack then i don't know what i can do.
��
Le 2017-09-25 12:42, Marcus Denker a wrote :
you could iterate all processes, there then get the stack and look up the sender chain
if the method is somewhere to be found. If yes -> it is exectuted right now.
One problem is that which methods are on the stack changes, so you shouldtry to avoid process switches while doing the analysis.��MarcusOk so if i know which process to analyse, i can just do something like the following that i found in the Halt class:
[ cntxt isNil ] whileFalse: [
���� ������ ��cntxt selector = aSelector ifTrue: [ ... ].
���� ������ ��cntxt := cntxt sender ]But if i actually found the method i was looking for on the stack, can i somehow ask the suspended context to "execute" until it returns from this method ?
Steven.
��