On Thu, Nov 12, 2009 at 05:48:52AM +0200, Igor Stasenko wrote:
2009/11/12 David T. Lewis lewis@mail.msen.com:
On Wed, Nov 11, 2009 at 09:16:44PM +0200, Igor Stasenko wrote:
Instead, why not expose the new VM abilities to language, so one could tell that specified callout should use a specified thread. Something like:
threadHandle := Smalltalk currentThreadId.
It is not hard to make these things accessible in the image, for example:
??OSProcess thisOSProcess pthread ==> a ByteArray(240 166 184 224 255 255 255 255)
(this on a 64-bit platform, hence the 8-byte handle)
its not really matters what object represents the thread handle (it could be simple smallint). And surely, its not that hard to expose some thread-aware API to language level, given that VM _is_ thread-aware. But by not exposing it, we losing another lever of control, using which we could write a sophisticated software, purely in smalltalk without getting down at C level. That's what i ment to say.
Yes I think that I understand your meaning. I was trying to agree with you ;-)
Unix, Windows, and Mac have similar (but not identical) thread models, and these can be made available to the image as you suggest. Getting the cross-platform semantics right may be difficult but I am sure that it can be done. And yes, the VM must be aware of the threads in order to expose them to the image in a useful way.
Dave