Re: EU Threading? Is it planned?
- Posted by "Mario Steele" <eumario at tuscanchat.com> Mar 26, 2004
- 416 views
I hate to burst everyone's bubble, but Euphoria is actually Threads safe. How can this be? How can this actually be, that Euphoria is Threads Safe, but not visible to the naked eye? Complete, and utter Blasphomy! Well, I'm here to tell ya, that Threads are actually alive in Euphoria! Both on Linux operating systems, and on Windows. And this isn't emulated or nothing. Now, while it is true, normal Euphoria alone, does not have threads, we have to look to the libraries we use, that are Threads capable, such as Win32lib, with it's Window Message Events, or WinSock with it's Async operation. And even on linux, the tcp/ip libarary there, is threads capable. Now you may ask, how can this be? There's no two instances of Euphoria going for a single program, and if euphoria is proccessing a event for a very long time, that the program seems to hang. Okay, this is true, since euphoria can only handle 1 instance at a time, it can only proccess the code 1 event at a time. However, WinSock/Linux TCP and Win32lib/Raw WinAPI isn't limited to just 1 instance. Cause, even though your program is stuck in that loop for a long time. Events are still proccessing in the background, and being queried for your program to complete, apon finishing it's task. That's what the true meaning of threading is, the fact that the system queries the events, until a instance can proccess it. Now, while at the programmer level of the language, this would normally mean, that a call back would be implemented for when it needs to start a new instance to handle a certian event. This is truely all that is lacking in Euphoria, is the implementation of a call back system to start up a new Thread to handle the event. We have one half of the equasion. We but need to make the new part of the equasion, to finish the task. Now, with Rob's improvements to the Interpreter (Mainly it being 70 pct C 30 pct Eu, or whatever the formula is), it may very well be possible to implement threads at the Euphoria Level. For all points of the matter, all that is needed, is to create a new instance of the Interpiter within the same program space, so it can access the same memory. Now, I'm not pushing for Threaded code, though it would definatly be nice, and Ofcourse I'm trying to open a perverbial can of worms, to prove a point. That it takes time for something to be implemented (Just look at the diffrences between DOS/Win3.x to Win 95, and up). Complaining about it, is not goning to solve anything. Wait for Eu 2.5 to come out, where there's more chances to improve it, at the Euphoria Level, instead of at the C level, and see if we can't come up with a Viable solution to everyone's request for Threads, or New Features in Euphoria, through the Euphoria version of the Interpreter itself. Which personally, I think would definatly be a big help to validating some of the features we want, and actually show Rob the actual code to make it work. After all, we have a Forum, that we all communicate on, and we all make contributions to the Archives, for others to make use of. So why not do the same for the Language itself, at the interpreter level. Okay, enough of my rambling. I'll let you all go back to what you was doing. Mario Steele EuMario