SpectMorph
smjobqueue.hh
1 // Licensed GNU LGPL v3 or later: http://www.gnu.org/licenses/lgpl.html
2 
3 #ifndef SPECTMORPH_JOB_QUEUE_HH
4 #define SPECTMORPH_JOB_QUEUE_HH
5 
6 #include <stdlib.h>
7 #include <unistd.h>
8 #include <stdio.h>
9 #include <sys/types.h>
10 #include <sys/wait.h>
11 
12 #include <string>
13 #include <vector>
14 
15 namespace SpectMorph
16 {
17 
18 class JobQueue
19 {
20  size_t max_jobs;
21  std::vector<pid_t> active_pids;
22  bool all_exit_ok;
23 
24  void wait_for_one();
25 
26 public:
27  JobQueue (size_t max_jobs = 1);
28 
29  bool run (const std::string& cmdline);
30  bool wait_for_all();
31 
32  ~JobQueue();
33 };
34 
35 } // namespace SpectMorph
36 
37 #endif
Definition: smalignedarray.cc:7
Definition: smjobqueue.hh:18