Free Electron
ThreadSignaler.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __threadsignal_ThreadSignaler_h__
8 #define __threadsignal_ThreadSignaler_h__
9 
10 namespace fe
11 {
12 namespace ext
13 {
14 
15 /** @brief SignalerI that calls registered HandlerI instances in parallel
16 
17  @ingroup signal
18 */
19 class FE_DL_EXPORT ThreadSignaler:
20  public ChainSignaler,
21  public Initialize<ThreadSignaler>
22 {
23  public:
24  ThreadSignaler(void);
25 virtual ~ThreadSignaler(void);
26 
27  void initialize(void);
28 
29  protected:
30 
31 virtual void signalEntries(Record &signal, t_entrymap *a_entryMap);
32 
33  private:
34 
35  class SignalWorker: public Thread::Functor
36  {
37  public:
38  SignalWorker(
39  sp< JobQueue< sp<HandlerI> > > a_spJobQueue,
40  U32 a_id,String a_stage):
41  m_id(a_id),
42  m_hpJobQueue(a_spJobQueue) {}
43 
44  virtual ~SignalWorker(void) {}
45 
46  virtual void operate(void);
47 
48  void setObject(sp<Component> spObject)
49  { m_hpThreadSignaler=spObject; }
50 
51  private:
52  U32 m_id;
53  hp< JobQueue< sp<HandlerI> > > m_hpJobQueue;
54  hp<ThreadSignaler> m_hpThreadSignaler;
55  };
56 
57  Record m_signal;
58 };
59 
60 } /* namespace ext */
61 } /* namespace fe */
62 
63 #endif /* __threadsignal_ThreadSignaler_h__ */
64 
kernel
Definition: namespace.dox:3
Per-class participation in the Initialized <> mechanism.
Definition: Initialized.h:117
SignalerI that calls registered HandlerI instances in parallel.
Definition: ThreadSignaler.h:19
Safe handle for shared pointer.
Definition: Handled.h:61
Automatically reference-counted string container.
Definition: String.h:128
Reference to an instance of a Layout.
Definition: RecordSB.h:35
Intrusive Smart Pointer.
Definition: src/core/ptr.h:53
Queue of tasks.
Definition: JobQueue.h:29
SignalerI that calls registered HandlerI instances in order.
Definition: ChainSignaler.h:29