Make WvStreams compile with gcc 4.4.
[wvstreams.git] / streams / wvsubprocqueuestream.cc
blob08d285dbb342c3df94d47958f0823fbbfbb0a073
1 /*
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4 *
5 * A more convenient way to use WvSubProcQueue. See wvsubprocqueuestream.h.
6 */
7 #include "wvsubprocqueuestream.h"
10 WvSubProcQueueStream::WvSubProcQueueStream(int _maxrunning)
11 : WvSubProcQueue(_maxrunning), log("Subproc Queue", WvLog::Debug5)
13 alarm(0);
17 WvSubProcQueueStream::~WvSubProcQueueStream()
22 void WvSubProcQueueStream::execute()
24 int started = WvSubProcQueue::go();
25 int run = running(), remain = remaining();
26 if (started || run || remain)
27 log("Started %s processes (%s running, %s waiting)\n",
28 started, run, remain - run);
29 if (!remain)
30 alarm(1000); // nothing is even in the queue; come back later.
31 else if (started)
32 alarm(0); // we're busy; go fast if possible
33 else
34 alarm(100); // no processes were ready *this* time; wait longer