ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/pjob/pjob.c
(Generate patch)

Comparing projects/pjob/pjob.c (file contents):
Revision 1.2 by pajs, Mon Jan 23 22:12:39 2006 UTC vs.
Revision 1.3 by pajs, Tue Jan 24 20:15:25 2006 UTC

# Line 85 | Line 85 | void process_child(gpointer data, gpointer user_data){
85          struct pollfd fds[3];
86          gint fdssize=2;
87  
88 +        proc->timer = g_timer_new();
89 +        g_timer_start(proc->timer);
90 +
91          /* Setup files in output dir if requested to do so */
92          if(outdir != NULL){
93                  proc->file_stdout = g_strdup_printf("%s/%s-STDOUT", outdir, proc->jobname);
# Line 162 | Line 165 | void process_child(gpointer data, gpointer user_data){
165                  poll(fds, fdssize, -1);
166                  /* For stdout and stderr see if there is any data, and read it */
167                  for(x=0; x<2; x++){
168 <                        if((fds[x].revents|POLLIN) == fds[x].revents){
168 >                        if((fds[x].revents & POLLIN) == 0){
169                                  /* We have data to read */
170                                  g_io_channel_read_line(sout[x], &readbuf, &rdatasize, NULL, NULL);
171                                  if(rdatasize > 0){
# Line 180 | Line 183 | void process_child(gpointer data, gpointer user_data){
183                          }
184                  }
185                  /* See if we need to pump more data down stdin */
186 <                if((fds[2].revents|POLLOUT) == fds[2].revents){
186 >                if((fds[2].revents & POLLOUT) != 0){
187                          /* We have data we can write */
188                          gchar *nextline;
189                          gint nextlinesize;
# Line 202 | Line 205 | void process_child(gpointer data, gpointer user_data){
205                  /* Even if we did get a hangup - lets make sure there is no more data to read first by looping again */
206                  if (readdata) continue;
207  
208 <                if(((fds[0].revents|POLLHUP) == fds[0].revents) && ((fds[1].revents|POLLHUP) == fds[1].revents)) break;
208 >                if(((fds[0].revents & POLLHUP) != 0) && ((fds[1].revents & POLLHUP) != 0)) break;
209          }      
210 +
211 +        g_timer_stop(proc->timer);
212  
213          g_io_channel_shutdown(sout[0], TRUE, NULL);
214          g_io_channel_shutdown(sout[1], TRUE, NULL);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines