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.4 by pajs, Wed Jan 25 19:57:12 2006 UTC vs.
Revision 1.6 by pajs, Mon Jan 30 21:46:59 2006 UTC

# Line 27 | Line 27
27   #include <poll.h>
28   #include <sys/types.h>
29   #include <sys/wait.h>
30 + #include <sys/resource.h>
31  
32   #define DEFNUMTHREAD 10
33   #define DEFTIMEOUT 60
# Line 168 | Line 169 | void process_child(gpointer data, gpointer user_data){
169                  poll(fds, fdssize, -1);
170                  /* For stdout and stderr see if there is any data, and read it */
171                  for(x=0; x<2; x++){
172 <                        if((fds[x].revents & POLLIN) == 0){
172 >                        if((fds[x].revents & POLLIN) != 0){
173                                  /* We have data to read */
174                                  g_io_channel_read_line(sout[x], &readbuf, &rdatasize, NULL, NULL);
175                                  if(rdatasize > 0){
# Line 331 | Line 332 | int main(int argc, char **argv){
332          GError *pp_err = NULL, *err = NULL;
333          gint x;
334  
335 +        struct rlimit rlp;
336 +
337          GOptionContext *optcontext;
338  
339          optcontext = g_option_context_new(" - parallel job executer");
# Line 360 | Line 363 | int main(int argc, char **argv){
363          }else{
364                  g_printerr("Threading not supported\n");
365          }
366 +
367 +        /* Up the number of FD's to the "hard" limit.
368 +         * This is mainly to get around the very small default
369 +         * solaris has, or 256
370 +         */
371 +        getrlimit(RLIMIT_NOFILE, &rlp);
372 +        rlp.rlim_cur = rlp.rlim_max;
373 +        setrlimit(RLIMIT_NOFILE, &rlp);
374          
375          if(verbose) g_printerr("Creating a threadpool %d in size\n", numthreads);
376          procpool = g_thread_pool_new(process_child, NULL, numthreads, FALSE, &pp_err);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines