multithreaded VMs

John M McIntosh johnmci at smalltalkconsulting.com
Sat Feb 10 04:15:18 UTC 2001


>
>I have always stayed away from trying to use cooperative threads in a plugin
>(in my case, a TWAIN plugin), because your host application's event loop may
>or may not be calling YieldToAnyThread(). Additionally, it could easily
>confuse [read: crash] the host application if you make a callback into it
>from a different thread than the host application's main thread. Not wanting
>to debug Photoshop, Acrobat, and any other TWAIN application, I never tried
>it.
>

Ok, well I coded up a Browser plugin for 3.0 today using threadlib. 
It seems Internet Exploder/Explorer? uses threadlib quite a bit, and 
the logic is now easier to deal with.

For the curious IE feeds events into your application, were you 
process them and then return control. In 2.8 we would run the 
interpreter for a while, then stop and return control. However it was 
messy.

In 3.0 with threading I just fork off  the VM, and then when I get an 
event from IE in, I just put on the event queue and return to IE. At 
shutdown time I now can ask the Vm to terminate and then wait for the 
VM thread to finish. The old logic would just abort the interpreter.

PS I've suggested that we have a quit event that a plugin/primitive 
can issue, which will nicely invoke quite processing in Smalltalk. 
The issue here is that in the Browser if you reload or change pages, 
or close the window you get a destroy event from the browser, now 
what... For the 2.8 mac browser VM we just terminated the VM in mid 
stream so to speak, which would leave files open etc.
-- 
--
===========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================
Custom Macintosh programming & various Smalltalk dialects
PGP Key: DSS/Diff/46FC3BE6
Fingerprint=B22F 7D67 92B7 5D52 72D7  E94A EE69 2D21 46FC 3BE6
===========================================================================





More information about the Squeak-dev mailing list