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 "forkedcall.h"
27 class ForkedCallQueue {
29 /// A process in the queue
30 typedef std::pair<string, Forkedcall::SignalTypePtr> Process;
31 /** Add a process to the queue. Processes are forked sequentially
32 * only one is running at a time.
33 * Connect to the returned signal and you'll be informed when
34 * the process has ended.
36 Forkedcall::SignalTypePtr add(string const & process);
37 /// Query whether the queue is running a forked process now.
39 /// Get the and only instance of the class
40 static ForkedCallQueue & get();
44 /** this class is a singleton class... use
45 * ForkedCallQueue::get() instead
49 std::queue<Process> callQueue_;
59 void callback(pid_t, int);
62 #endif // FORKEDCALLQUEUE_H