Re: Threads vs Processes

new topic     » goto parent     » topic index » view thread      » older message » newer message

Yes, there is.
Unfortunately, not within Euphoria itself.

There's a library called IPC that allows you to make procedure and
function calls across euphoria programs. Procedure calls are
asynchronous, function calls are synchronous.

In your case, write two programs - your GUI, and the program
responsible for doing the checking. When the GUI is run it should
spawn the other program (using win32lib's systemExec(), for example)

The program doing the checking would have a procedure like
'startEmailCheck' that would download the email data you needed. (It's
a procedure, not a function, so the GUI can keep operating meanwhile).
If you want to have a progress bar or some indication of progress, you
can have the email processing program call an 'updateProgress'
procedure in the GUI (which will be run as soon as it's not processing
a windows event) every time something significant happens, like a new
message has been downloaded...
When the action is completely finished, call a 'finishedEmailCheck'
procedure in the GUI. This procedure would show that the action is
finished, and would contain all the data in its parameters.

IPC's pretty easy to use, and while there is a particular case where
it's a bit buggy, you have to have lots of programs (>2) talking to
each other constantly for it to occur.

On 5/3/05, Bruce Douglas <bruce_list at tutopia.com.br> wrote:
>
> Hello, I am new at Euphoria and am really happy with it. I have 2
> projects in C++ which were stalled which I have ported to Euphoria
> and have made a lot of progress now. I am using wxEuphoria
> which is important for me because I work in Linux but deploy these
> programs on Windows computers.  So, thank-you, Rob and Matt!
>
> I have been following your debate on threads vs. processes with
> great interest.  I hope this is not a dumb question. smile
>
> My question is how you implement processes? For example, I'm working
> on an email checker / deleter and would like to be able to connect
> simultaneously to several accounts. Also, I have times when the connectio=
n
> freezes but doesn't disconnect and then my poor program gets trapped in t=
he
> socket call and never returns. I have a timer() call set up but the
> program is
> not available to check the timer.
>
> It would be nice if I could just call a procedure but not wait for it to
> finish.
> When it was good and ready, it could generate an event or set a variable =
or
> whatever. If it doesn't return in a certain time, I can have the program
> handle
> this more gracefully.
>
> I would like to avoid using the Windows API calls since I would like my
> programs to still work in Linux.
>
> Is there a way to implement this without threads?
>
> Thanks in advance,
> Bruce Douglas
>
>
>
>
>


--
MrTrick
----------

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu