1. Using the Windows threads and processes functions

All,

Back in my Borland C++/OWL days I wrote a program that started up a process
and would wait until the process completed before the "parent" program
would continue.  I know this question has come up before about using
shellExecute() to start a process and wait until it completes before 
continuing (which you can't do).

I've been looking into this again (and considering wrapping the process 
and thread APIs) and was wondering if anyone has ever used the CreateThread,
SuspendThread, ResumeThread and TerminateThread with Euphoria?  I 
was wondering if it was possible, using these routines, to simulate 
threads in Euphoria under Windows?  It seems to me that since Windows can
call a Euphoria routine it might be possible but I'm wondering that with
the non-threaded nature of Euphoria would this not work?

Any insights would be appreciated.

Jonas

new topic     » topic index » view message » categorize

2. Re: Using the Windows threads and processes functions

Jonas Temple wrote:
> 
> I've been looking into this again (and considering wrapping the process 
> and thread APIs) and was wondering if anyone has ever used the CreateThread,
> SuspendThread, ResumeThread and TerminateThread with Euphoria?  I 
> was wondering if it was possible, using these routines, to simulate 
> threads in Euphoria under Windows?  It seems to me that since Windows can
> call a Euphoria routine it might be possible but I'm wondering that with
> the non-threaded nature of Euphoria would this not work?

Never mind...I just searched the archive and I'm not the first to go down
this dead-end road.

Rob, I know this pot has been stirred in the past, but it SURE would be 
nice if Euphoria had thread support.  How about creating a separate 
experimental version of Eu that supports threads that we could all "test"
for you?  I'm not saying that I would quit using Eu if it didn't have
threads, but my software suffers in some isolated circumstances BECAUSE
it doesn't have threads.

Jonas

new topic     » goto parent     » topic index » view message » categorize

3. Re: Using the Windows threads and processes functions

On 14 Jul 2004, at 7:34, Jonas Temple wrote:

> 
> 
> posted by: Jonas Temple <jtemple at yhti.net>
> 
> All,
> 
> Back in my Borland C++/OWL days I wrote a program that started up a process
> and
> would wait until the process completed before the "parent" program would
> continue.  I know this question has come up before about using shellExecute()
> to
> start a process and wait until it completes before continuing (which you can't
> do).

But you can. Use the olde flagfile.txt, check it, if the child process didn't 
delete it, then the child process isn't finished, so don't continue the parent 
process. 

flagfile = open(flagfilename,"r")
while equal(flagfile,-1) then
  sleep(1)
  flagfile = open(flagfilename,"r")
end while
close(flagfile)
-- resume executing, the child is done

And someone submitted a WM_ eavesdropper, perhaps your process could 
monitor, looking for a shutdown wmsg?

Or, i wasn't kidding when i said the Eu "windows server" was a reinvented 
win3.1. Use it for your processes to talk to each other?

Kat

new topic     » goto parent     » topic index » view message » categorize

4. Re: Using the Windows threads and processes functions

Jonas Temple wrote:
> Rob, I know this pot has been stirred in the past, but it SURE would be 
> nice if Euphoria had thread support.  How about creating a separate 
> experimental version of Eu that supports threads that we could all "test"
> for you?  I'm not saying that I would quit using Eu if it didn't have
> threads, but my software suffers in some isolated circumstances BECAUSE
> it doesn't have threads.

Adding threads to the interpreter would be a major project.
Testing is not the main issue.
I may get around to it some day.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view message » categorize

5. Re: Using the Windows threads and processes functions

On Wed, 14 Jul 2004 07:34:45 -0700, Jonas Temple
<guest at RapidEuphoria.com> wrote:

>All,
>
>Back in my Borland C++/OWL days I wrote a program that started up a process
>and would wait until the process completed before the "parent" program
>would continue.  I know this question has come up before about using
>shellExecute() to start a process and wait until it completes before 
>continuing (which you can't do).

I have just submitted a short routine originally by Juergen Luethje
which may be of interest, maybe not. It loops, sleeping for 1/25th of
a second, waiting for the child process to complete, and invokes
doEvents() if win32lib is in use (but does NOT require win32lib to be
present). It has proved handy for me, though one limitation I know is
you cannot redirect output:

http://palacebuilders.pwp.blueyonder.co.uk/euphoria.html#syswait

(nothing specifically to do with "threads", btw)

Regards,
Pete

new topic     » goto parent     » topic index » view message » categorize

6. Re: Using the Windows threads and processes functions

Hello all,

My next version of the WinClass Library will have something
similar to a secondary thread, where you can do things that
take an extremely long time (like save a large file) while
the user still gets to choose options such as 'stop saving',
etc., or menu options, and doesnt stop the windows from being
redrawn.  You can give the user the option of 'quiting' the 
program or prevent them from quiting while the file is being 
saved, so the app doesnt loose data because they quit early.

Even so, i can still see using two Euphoria exe's and file
mapping as a good alternative to threads, where the two
share only the data they need to share.  Might acutally
be simpler then implementing an app using multiple threads
anyway because it force you to keep careful track of what data
is being shared.


Take care,
Al

And, good luck with your Euphoria programming!

My bumper sticker: "I brake for LED's"

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu