Posted: Wed Jan 24, 2007 4:32 pm Post subject: No Way to stop processes? URGENT
I really need to stop it for my read and write file at the end to work...
Can some teach me how to stop fork?
I can't really change the whole program much any more...
Sponsor Sponsor
ericfourfour
Posted: Wed Jan 24, 2007 5:14 pm Post subject: RE:No Way to stop processes? URGENT
Well, the best advice I can give you is: don't use processes.
Cervantes
Posted: Wed Jan 24, 2007 5:22 pm Post subject: RE:No Way to stop processes? URGENT
ericfourfour's advice is correct, but if you're stuck and you don't have the time to change the structure of your code too much, I'll offer another solution.
I suspect you've got a loop inside the process that you've forked. Give the loop and exit condition. That condition will be the same as the condition that made you want to stop your fork. (This might require using a global boolean value, depending on the condition.)
cam
Posted: Wed Jan 24, 2007 5:30 pm Post subject: Re: RE:No Way to stop processes? URGENT
Cervantes @ Wed Jan 24, 2007 5:22 pm wrote:
ericfourfour's advice is correct, but if you're stuck and you don't have the time to change the structure of your code too much, I'll offer another solution.
I suspect you've got a loop inside the process that you've forked. Give the loop and exit condition. That condition will be the same as the condition that made you want to stop your fork. (This might require using a global boolean value, depending on the condition.)
thx
Clayton
Posted: Wed Jan 24, 2007 6:23 pm Post subject: Re: No Way to stop processes? URGENT
or, if you've got some code after said loop, I believe return will work as well. just have an if statement, and if it's true, execute the return statement.