program 'hangs' when running several instances of program for writing to a file...
Hilda Klasky
hklasky@mcdc.panasonic.com
Mon Jun 16 18:53:00 GMT 2003
Hi Everyone, I hope some one could help me please.
I am using:
Red Hat 9.0
Kernel 2.4.20-8
gcc 3.2.2
My program writes to a file 25K of data every 25 milliseconds. It optionally
flushes the buffer as specified by the user on the entry parameters.
The problem I have is that, when I attempt to run two instances of the
program, (each one writes to a different file); one of the process 'hangs'
(stops writing to the file), when I select the flush option to be on.
When I select the flush option to be off, and I run more than 2 instances of
the program, one of the process 'hangs' also.
I wonder if some how I am over loading some buffer.
I will appreciate your help. Thank you very much in advance.
The core of my code follows:
for (i=0;i<4000;i++){
//get the time
t1=microseconds();
//write the block of data
of.write(buffer, (unsigned int) read_size);
if (flush){
of.flush();
}//flush
//get the time again
t2=microseconds();
//sleep time:
long int sleept = floor( ((t1+d)-t2)*1000);
usleep( sleept );
//end of sleep time
}//for i=1 to ..
More information about the Gcc-help
mailing list