OnixS ICE iMpact Multicast Price Feed Handler C++ library  8.18.0
API documentation
FeedEngineListener.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Onix Solutions Limited. All rights reserved.
3  *
4  * This software owned by Onix Solutions Limited and is protected by copyright law
5  * and international copyright treaties.
6  *
7  * Access to and use of the software is governed by the terms of the applicable ONIXS Software
8  * Services Agreement (the Agreement) and Customer end user license agreements granting
9  * a non-assignable, non-transferable and non-exclusive license to use the software
10  * for it's own data processing purposes under the terms defined in the Agreement.
11  *
12  * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
13  * of this source code or associated reference material to any other location for further reproduction
14  * or redistribution, and any amendments to this copyright notice, are expressly prohibited.
15  *
16  * Any reproduction or redistribution for sale or hiring of the Software not in accordance with
17  * the terms of the Agreement is a violation of copyright law.
18  */
19 
20 #pragma once
21 
22 #include "Export.h"
23 
24 namespace OnixS { namespace ICE { namespace iMpact { namespace MarketData {
25 
26 /// Identifies reasons feed engine threads becomes idle.
28 {
29  /// \copydoc FeedEngineThreadIdleReasons
30  enum Enum
31  {
32  /// Thread waited for incoming data using corresponding
33  /// I/O operations (like 'select') and exited waiting with
34  /// no data availability signs.
36 
37  /// Thread entered idle state due to absence of any data and
38  /// while other threads are waiting for new incoming data.
40  };
41 };
42 
43 /// Reason feed engine threads becomes idle.
45 
46 /// forward declarations
47 class FeedEngine;
48 
49 /// Listener for thread-related events.
50 ///
51 /// Members of this classes are invoked to reflect
52 /// various life-time events of threads spawned and
53 /// used by the feed engine while processing market data.
54 class ONIXS_ICEMDH_EXPORT FeedEngineListener
55 {
56 public:
57  /// Member invoked by feed engine when
58  /// a new processing thread is spawned.
59  ///
60  /// \note Invocation is done within newly started thread.
61  ///
62  /// \param engine An instance of the feed angine.
63  virtual void onFeedEngineThreadBegin(const FeedEngine& engine);
64 
65  /// Member is invoked by feed engine when processing
66  /// thread is about to end.
67  ///
68  /// \note Invocation is done within the thread that is
69  /// about to end.
70  ///
71  /// \param engine An instance of the feed angine.
72  virtual void onFeedEngineThreadEnd(const FeedEngine& engine);
73 
74  /// Is called when feed engine's thread is idle.
75  ///
76  /// Thread becomes idle when either no data is received within
77  /// time interval defined by FeedEngineSettings::dataWaitTime
78  /// parameter or no pending data is available for processing.
79  /// In the first case, callback is invoked with 'DataWaitTimeout'
80  /// reason. In the second case, thread is considered as redundant
81  /// and thus callback is invoked with 'Redundant' reason.
82  /// After callback invocation threads may sleep in kernel to reduce
83  /// load onto CPU and racing between feed engine working threads.
84  ///
85  /// \param engine An instance of the feed angine.
86  /// \param reason Reason feed engine threads becomes idle.
87  /// \param timeout Defines amount of time feed engine suggest
88  /// for thread to sleep in kernel after invoking given member.
89  virtual void onFeedEngineThreadIdle(
90  const FeedEngine& engine,
91  FeedEngineThreadIdleReason reason,
92  unsigned int& timeout
93  );
94 
95 protected:
96  virtual ~FeedEngineListener() {}
97 };
98 
100 
102 
103 inline void FeedEngineListener::onFeedEngineThreadIdle(const FeedEngine&, FeedEngineThreadIdleReason, unsigned int&) {}
104 
105 }}}} // namespace OnixS::ICE::iMpact::MarketData
Identifies reasons feed engine threads becomes idle.
virtual void onFeedEngineThreadBegin(const FeedEngine &engine)
Manages processing machinery for market data received from feeds.
Definition: FeedEngine.h:32
FeedEngineThreadIdleReasons::Enum FeedEngineThreadIdleReason
Reason feed engine threads becomes idle.
Enum
Identifies reasons feed engine threads becomes idle.
virtual void onFeedEngineThreadEnd(const FeedEngine &engine)
virtual void onFeedEngineThreadIdle(const FeedEngine &engine, FeedEngineThreadIdleReason reason, unsigned int &timeout)