Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Simple multi-threading

Reply
Thread Tools

Simple multi-threading

 
 
howa
Guest
Posts: n/a
 
      06-21-2008
Currently I have a single threaded server, developed using C, serving
multiple client at the same time, now I want a new feature:

a. I need to execute a particular program at some point, e.g.
email.exe
b. the email.exe might need some time to finish, so it block my main
program
c. I don't need to collect the output from email.exe, just best-effort-
executed is okay

Without changing my program to a multi-threaded program, I am not sure
if it is recommended to execute the email.exe using system + at
command.

I mean if it is scalable and reliable.


Thanks.
 
Reply With Quote
 
 
 
 
Jerry Coffin
Guest
Posts: n/a
 
      06-21-2008
In article <e4556b25-c388-424b-925e-
>, says...

[ starting an external program asynchronously ... ]

> Without changing my program to a multi-threaded program, I am not sure
> if it is recommended to execute the email.exe using system + at
> command.
>
> I mean if it is scalable and reliable.


There's no particular reason is shouldn't work, but it's not what I'd
recommend -- I'd probably call CreateProcess, though you could consider
ShellExecute, ShellExecuteEx, WinExec, etc. Using these you can fairly
easily detect a truly catastrophic failure, such as the executable
you're trying to use not existing, while still avoiding waiting for it
to finish executing or anything like that.

--
Later,
Jerry.

The universe is a figment of its own imagination.
 
Reply With Quote
 
 
 
 
James Kanze
Guest
Posts: n/a
 
      06-21-2008
On Jun 21, 4:44 pm, howa <howac...@gmail.com> wrote:
> Currently I have a single threaded server, developed using C, serving
> multiple client at the same time, now I want a new feature:


> a. I need to execute a particular program at some point, e.g.
> email.exe
> b. the email.exe might need some time to finish, so it block my main
> program
> c. I don't need to collect the output from email.exe, just best-effort-
> executed is okay


> Without changing my program to a multi-threaded program, I am not sure
> if it is recommended to execute the email.exe using system + at
> command.


> I mean if it is scalable and reliable.


I'm not too sure what the question is. If the system supports
it, you can definitely start a program in background using the
system command; something like ``system( "mail &" )'' will work
on all Unix systems I know. (Actually, it won't, because
without any furthre arguments, "mail" is interactive. But if
you give it the name of a file to be sent, and where to send it,
there's no problem.) I can hardly imagine that the situation
would be different with any other OS (but I don't know offhand
how to start a program in background using system under
Windows).

--
James Kanze (GABI Software) email:
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple VB.Net / webservice requirement (but not simple for me....) Dave E ASP .Net 7 01-11-2006 02:07 PM
Simple Question - Simple Answer? Daniel Frey XML 4 01-12-2005 04:25 PM
Re: Simple Simple question!!! Kevin Spencer ASP .Net 0 06-25-2004 05:25 PM
Re: Simple Simple question!!! ashelley@inlandkwpp.com ASP .Net 0 06-25-2004 04:18 PM
A few simple problems in a simple program. jmac@berkeley.edu C Programming 7 07-23-2003 09:51 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57