• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

OpenLightingProject / ola / 21336882381

25 Jan 2026 05:47PM UTC coverage: 45.06% (-0.7%) from 45.72%
21336882381

Pull #1984

github

web-flow
Merge b8c8613eb into 704337b09
Pull Request #1984: Add conditionals for Protobuf 22+ API changes

8556 of 19814 branches covered (43.18%)

5 of 6 new or added lines in 3 files covered. (83.33%)

324 existing lines in 56 files now uncovered.

22100 of 49046 relevant lines covered (45.06%)

48.42 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/include/ola/thread/ConsumerThread.h
1
/*
2
 * This library is free software; you can redistribute it and/or
3
 * modify it under the terms of the GNU Lesser General Public
4
 * License as published by the Free Software Foundation; either
5
 * version 2.1 of the License, or (at your option) any later version.
6
 *
7
 * This library is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10
 * Lesser General Public License for more details.
11
 *
12
 * You should have received a copy of the GNU Lesser General Public
13
 * License along with this library; if not, write to the Free Software
14
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
 *
16
 * ConsumerThread.h
17
 * An thread which consumes Callbacks from a queue and runs them.
18
 * Copyright (C) 2011 Simon Newton
19
 */
20

21
#ifndef INCLUDE_OLA_THREAD_CONSUMERTHREAD_H_
22
#define INCLUDE_OLA_THREAD_CONSUMERTHREAD_H_
23

24
#include <ola/Callback.h>
25
#include <ola/base/Macro.h>
26
#include <ola/thread/Thread.h>
27
#include <queue>
28

29
namespace ola {
30
namespace thread {
31

32
/**
33
 * A thread which waits on a queue, and when actions (callbacks) become
34
 * available, it pulls them from the queue and executes them.
35
 */
36
class ConsumerThread: public ola::thread::Thread {
37
 public :
38
  typedef BaseCallback0<void>* Action;
39
  /**
40
   * @param callback_queue the queue to pull actions from
41
   * @param shutdown a bool which is set to true if this thread is to finish.
42
   * @param mutex the Mutex object which protects the queue and shutdown
43
   *   variable.
44
   * @param condition_var the ConditionVariable to wait on. This signals when
45
   *   the queue is non-empty, or shutdown changes to true.
46
   * @param options The thread options.
47
   */
48
  ConsumerThread(std::queue<Action> *callback_queue,
14✔
49
                 const bool *shutdown,
50
                 Mutex *mutex,
51
                 ConditionVariable *condition_var,
52
                 const Thread::Options& options = Thread::Options())
53
      : Thread(options),
14✔
54
        m_callback_queue(callback_queue),
14✔
55
        m_shutdown(shutdown),
14✔
56
        m_mutex(mutex),
14✔
57
        m_condition_var(condition_var) {
14✔
58
  }
UNCOV
59
  ~ConsumerThread() {}
×
60
  void *Run();
61

62
 private:
63
  std::queue<Action> *m_callback_queue;
64
  const bool *m_shutdown;
65
  Mutex *m_mutex;
66
  ConditionVariable *m_condition_var;
67

68
  void EmptyQueue();
69

70
  DISALLOW_COPY_AND_ASSIGN(ConsumerThread);
71
};
72
}  // namespace thread
73
}  // namespace ola
74
#endif  // INCLUDE_OLA_THREAD_CONSUMERTHREAD_H_
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc