1. Threading with EXW
- Posted by John Cannon <jzcndd at EARTHLINK.NET> Oct 04, 1999
- 305 views
Greetings! I have a Win32 Euphoria program which must do a bit of number-crunching. While it is off on that assignment it does not fix damage to its windows. I wrapped up the CreateThread Win32 API routine with the idea that I'd send the number-crunching to a new thread. CreateThread returns successfully with a thread handle, but when I try to run the thread, the program bombs. I originally thought that call_back() was not giving me the proper starting address for the function. There's a warning about that in the CreateThread help topic. Now I think the problem is more fundamental: Exw cannot interpret several threads simultaneously. It looked so simple in Petzold, but his various threads get compiled. Has anyone else played with CreateThread? Am I right that it cannot be used? Any insight appreciated... John Cannon High Top Mountain Cottages http://www.mountaindog.net
2. Re: Threading with EXW
- Posted by "Cuny, David" <David.Cuny at DSS.CA.GOV> Oct 04, 1999
- 302 views
My impression from reading Petzold was that EXW does not support threads. -- David Cuny
3. Re: Threading with EXW
- Posted by Robert Craig <rds at ATTCANADA.NET> Oct 04, 1999
- 311 views
John Cannon writes: > Now I think the problem is more fundamental: > Exw cannot interpret several threads simultaneously. Support for multiple threads would require extensive modifications to the Euphoria interpreter. It isn't something that you can do, as a Euphoria programmer, just by calling WIN32 API routines. A WIN32 program can create multiple threads, each with its own separate call stack, but sharing the same global variables. Each thread runs "in parallel" with the other threads, and there are various mechanisms to prevent threads from interfering with each other. You may have succeeded in creating multiple threads of the interpreter itself, each one messing with global variables, without any awareness of the others. I'm not surprised it crashed. Euphoria might support multiple threads someday, but it would take a lot of recoding, to make it work. For instance there would have to be multiple Euphoria call stacks, and multiples of many other internal data structures. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com
4. Re: Threading with EXW
- Posted by Kat <KSMiTH at PELL.NET> Oct 05, 1999
- 299 views
----- Original Message ----- From: Robert Craig <rds at ATTCANADA.NET> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Monday, October 04, 1999 5:02 PM Subject: Re: Threading with EXW > John Cannon writes: > > Now I think the problem is more fundamental: > > Exw cannot interpret several threads simultaneously. > > You may have succeeded in creating multiple threads > of the interpreter itself, each one messing with global > variables, without any awareness of the others. > I'm not surprised it crashed. > Has anyone tried a separate install of Eu for each thread they want to run,, in differently named directories? Will that work or will each instance look like the same instance when they talk to Windoze? Kat
5. Re: Threading with EXW
- Posted by Roderick Jackson <rjackson at CSIWEB.COM> Oct 05, 1999
- 314 views
John, If I may make a humble suggestion... if you find that CreateThread isn't able to do what you want, but still need multithreading, it might be worth your while to look at Topaz. Topaz is a multithreading scripting engine, one that's easy to embed into a Euphoria program. It has a small instruction set that can be extended as needed. It's stack-based, so it might take a while to rewrite your number-crunching algorithms to fit it, but Topaz's math instructions are Euphoric (working on both atoms and sequences), and it will do what you're looking for: emulate "background" processing. It's available at the Euphoria web site, under user contributions (or I can just email it to you.) Hopefully it can be a help, Rod Jackson P.S. -- I haven't got around to the next version with thread priorities yet, but I've had help with it, so they'll get implemented sooner or later... let me know if you need them. ---------- From: John Cannon[SMTP:jzcndd at EARTHLINK.NET] Sent: Monday, October 04, 1999 12:46 PM To: EUPHORIA at LISTSERV.MUOHIO.EDU Subject: Threading with EXW Greetings! I have a Win32 Euphoria program which must do a bit of number-crunching. While it is off on that assignment it does not fix damage to its windows. I wrapped up the CreateThread Win32 API routine with the idea that I'd send the number-crunching to a new thread. CreateThread returns successfully with a thread handle, but when I try to run the thread, the program bombs. <snip>