3 * \file forkedcallqueue.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Alfredo Braunstein (based on an idea from Angus Leeming)
9 * Full author contact details are available in file CREDITS.
11 * This class implements a queue of forked processes. In order not to
12 * hose the system with multiple processes running simultaneously, you can
13 * request the addition of your process to this queue and it will be
14 * executed when its turn comes.
18 #ifndef FORKEDCALLQUEUE_H
19 #define FORKEDCALLQUEUE_H
21 #include "support/forkedcall.h"
30 class ForkedCallQueue {
32 /// A process in the queue
33 typedef std::pair<std::string, Forkedcall::SignalTypePtr> Process;
34 /** Add a process to the queue. Processes are forked sequentially
35 * only one is running at a time.
36 * Connect to the returned signal and you'll be informed when
37 * the process has ended.
39 Forkedcall::SignalTypePtr add(std::string const & process);
40 /// Query whether the queue is running a forked process now.
42 /// Get the and only instance of the class
43 static ForkedCallQueue & get();
47 /** this class is a singleton class... use
48 * ForkedCallQueue::get() instead
52 std::queue<Process> callQueue_;
62 void callback(pid_t, int);
65 } // namespace support
68 #endif // FORKEDCALLQUEUE_H