Gabe Schaffer <[EMAIL PROTECTED]> wrote:I was just browsing the Parrot source, and noticed that the threading implementation is a bit Unix/pthread-centric. For example:
* COND_WAIT takes a mutex because that's how pthreads works, but Win32 condition variables (called "events") are kernel objects that do not require any other object to be associated with them. I think this could be cleaned up with further abstraction.
Not quite. COND_WAIT takes an opaque type defined by the platform, that happens to be a mutex for the pthreads based implementation.
Yep. This is important to note -- the joys of portability often means that functions in the source carry parameters that might not actually get used. That's the case here, since POSIX threads (which the unices and VMS use for their threading model) requires a mutex. I fully expect we'll have similar bits carried around to accomodate windows too.
> The big issue, though, is with the IO thread. On NT the IO is alreadyasync and there are no signals (Ctrl+C is handled with a callback), so each interpreter thread should just be able to handle all of this in the check_events functions.
Not all. We need to do check_events() for e.g. message passing too.
And notifications, and possibly cleanup of objects with finalizers.
> .... Win9x doesn't have async IO on files, so it still mightrequire separate threads to do IOs.
I'm not sure, if we even should support Win9{8,5}.
Nope. Or, rather, we officially don't care if we run on Win9x/WinME. If we do, swell. If not, well...
Win9x isn't particularly special here. We feel the same about AmigaDOS, VMS 5.5, HP/UX 10.x, SunOS, Linux 1.x, and BeOS. Amongst others.
> Anyway, it seems to me that all this event/IO stuff needssignificantly more abstraction in order to prevent it from becoming a hacked-up mess of #ifdefs.
Yep. The system-specific stuff should be split into platform files. A common Parrot API then talks to platform code.
Yeah. The event stuff's definitely primitive, and not much thought's been given to it as of yet.
--
Dan
--------------------------------------it's like this------------------- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk