473,387 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Simple multi-threading

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.
Jun 27 '08 #1
2 1302
In article <e4556b25-c388-424b-925e-
8a**********@d19g2000prm.googlegroups.com>, ho******@gmail.com 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.
Jun 27 '08 #2
On Jun 21, 4:44 pm, howa <howac...@gmail.comwrote:
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:ja*********@gmail.com
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
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Shane | last post by:
Hi, Thanks in advance for the help. I have been to many websites and tried several solutions to my problem, but have fixed part of it. It's time to come humbly to the newsgroups for help :-) ...
6
by: Eddie Smit | last post by:
field- field- surname town ---- ---- john NY john Vegas john Boston eddie Boston eddie New Orleans eddie NY
1
by: NYprmr | last post by:
Hi All, I'm trying to get value from Listbox where Multi Select property is set to Simple, meaning multiple values can be selected. Doing regular loop like following, retuns NULL value for each...
5
by: Lisa | last post by:
Hello, I am new to using recordsets, and i am completly stuck with this one. I am trying to use a multi select list box to write records to a table. Something in my code is causing the same...
7
by: abcd | last post by:
I am trying to set up client machine and investigatging which .net components are missing to run aspx page. I have a simple aspx page which just has "hello world" printed.... When I request...
10
by: serge calderara | last post by:
Dear all, I need to build a web application which will contains articles (long or short) I was wondering on what is the correct way to retrive those article on web page. In orther words, when...
3
by: Dara Durum | last post by:
Hi ! Py2.4, Win32. I need to optimize a program that have a speciality: hash (MD5/SHA1) the file contents (many files). Now I do this in a simple python program, because (what a pity) the...
10
by: R.A.M. | last post by:
Hello, I am trying to learn SQL Server. I need to write a trigger which deletes positions of the document depending on the movement type. Here's my code: set ANSI_NULLS ON set...
121
by: jacob navia | last post by:
Hi guys I have written this small parser to print out the functions defined in a C file. This is an example of parsing in C, that I want to add to my tutorial. Comments (and bug reports) are...
4
by: Axel Dahmen | last post by:
Hi, I've created a few simple console tools. No .NET used at all, just STL. Now I want to just XCOPY them to another machine. But running them there yields a couple of errors in the application...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.