On Sat, 25 Oct 2014, David T. Lewis wrote:
On Sun, Oct 26, 2014 at 02:06:20AM +0200, Levente Uzonyi wrote:
I've uploaded the new versions of the packages to The Inbox, and moved the old ones to The Treated Inbox. The main difference is that the Semaphore class is not modified, and its instances are handled like any other object. There's also a new #cleanUp: method which will allow freeing up some memory. And the caches are shrinked whenever the external objects are wiped. Since Semaphores don't know their indexes anymore, the new part of the API has also changed. The following snippet will load the new versions to an up-to-date Trunk image:
Installer squeakInbox package: 'System-ul.687'; package: 'Sound-ul.40'; package: 'Kernel-ul.883'; package: 'Network-ul.154'; package: 'Files-ul.140'; install
Levente
I like this a lot. Not only does it provide the ExternalSemaphoreTable improvements, but I also find that when I restart my image with OSProcess loaded, the indexesByObjects dictionary clearly shows the semaphore that was registered for the child process watcher at image startup. Thus an explorer on the ExternalSemaphoreTable will display semaphores associated with processes that wait on them, which also identifies the process waiting on that semaphore. You can see this right in the object explorer.
Very nice!
I note that a Semaphore can still know its external objects index by querying the ExternalSemaphoreTable:
Semaphore>>externalIndex ^ExternalSemaphoreTable externalIndexFor: self
ExternalSemaphoreTable class>>externalIndexFor: anObject ^self current indexesByObjects at: anObject ifAbsent: [nil]
ExternalSemaphoreTable>>indexesByObjects ^indexesByObjects
It's doable, but I don't think it's useful. The index is only meaningful for the plugins. Also, most of the API could be added to Semaphore too as Bert suggested. Btw, accessing #indexesByObjects is no thread-safe this way.
Levente
Dave