我正在关注 一本很棒的海边书,有一次我的形象完全卡住了。当时我正在调试器中,我尝试在以下代码片段的 ToDoDB root
部分上运行“检查它”:
ToDoDB createDB.
ToDoDB commit: [ ToDoDB root add: ToDoItem new ].
ToDoDB release.
之后我的图像停止响应任何内容。
我有点好奇为什么 Magma 在检查操作上会有这样的行为,但我更感兴趣的是了解解决这个问题的选择是什么?我应该扔掉这张图片并从头开始吗?我可以向虚拟机发送一些操作系统信号来终止活动线程之类的吗?这里是 Smalltalk 新手。
I was following the tutorial on Magma from the awesome Seaside book and at one point my image got stuck completely. I was in the debugger at that moment and I've tried to run "inspect it" on ToDoDB root
part of the following snippet:
ToDoDB createDB.
ToDoDB commit: [ ToDoDB root add: ToDoItem new ].
ToDoDB release.
After that my image stopped responding to anything.
I'm kind of curious why Magma behaved that way on inspect action, but I'm more interested in learning what are my options for fixing this issue? Should I just throw out this image and start from scratch? Can I send some OS signal to the VM to kill the active thread or something? Smalltalk newbie here.
发布评论
评论(2)
Sean 已经回答了,但您也可以在 pharo 协作书中找到它: http:// /book.pharo-project.org/book/TipsAndTricks/InterruptKey/
只是另一句话,你说“我可以向虚拟机发送一些操作系统信号来杀死活动线程之类的吗?Smalltalk新手 这里。”。请注意,大多数 Smalltalk 方言都有所谓的“绿线”。也就是说,从操作系统的角度来看,它只是一个线程。 Smalltalk 内部自行管理不同的流程和时间表。检查处理器、调度程序等类。所以...我的意思是,如果你想从外部杀死一个线程,你将杀死唯一的线程,整个虚拟机;)
Sean has already answered, but you can find it also in the pharo collaborative book: http://book.pharo-project.org/book/TipsAndTricks/InterruptKey/
Just another remark where you say "Can I send some OS signal to the VM to kill the active thread or something? Smalltalk newbie here.". Notice that most Smalltalk dialects have what is called "green thread". That is, that from the OS point of view it is only one thread. Smalltalk inside manages itself the different process and the schedule about it. Check classes like Processor, Scheduler, etc. So...what I am saying that if you want to kill a thread from outside, you will kill the only thread, the whole VM ;)
尝试发送中断。请参阅 http://wiki.squeak.org/squeak/899 了解适合您平台的快捷方式 (即底层操作系统)。
另外,您的意思可能是“扔掉这个映像”而不是“这个虚拟机”。 Pharo By Examples 是一个很棒的免费资源,介绍 Smalltalk 基础知识,例如图像、更改文件和虚拟机
Try sending an interrupt. See http://wiki.squeak.org/squeak/899 for the shortcut for your platform (i.e. underlying OS).
Also, you probably mean "throw out this image" instead of "this VM". Pharo By Example is a great free resource for Smalltalk basics like image vs. changes file vs. VM