MySQL  8.0.19
Source Code Documentation
message_service.h
Go to the documentation of this file.
1 /* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License, version 2.0,
5  as published by the Free Software Foundation.
6 
7  This program is also distributed with certain software (including
8  but not limited to OpenSSL) that is licensed under separate terms,
9  as designated in a particular file or component or in included license
10  documentation. The authors of MySQL hereby grant you an additional
11  permission to link the program and your derivative works with the
12  separately licensed software that they have included with MySQL.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License, version 2.0, for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef MESSAGE_SERVICE_H
24 #define MESSAGE_SERVICE_H
25 
29 
30 /**
31  Register default send message service.
32 */
34 
35 /**
36  Unregister default send message service.
37 */
39 
40 /**
41  @class Message_service_handler
42  Handles the deliver of recv service messages to subscribed modules.
43 */
45  public:
46  /**
47  Create a message service handler to deliver messages to recv subscribers.
48  */
50 
51  virtual ~Message_service_handler();
52 
53  /**
54  Initialize thread that will deliver messages.
55 
56  @return returns 0 if succeeds, error otherwise
57  */
58  int initialize();
59 
60  /**
61  Main loop that checks message availability.
62  */
63  void dispatcher();
64 
65  /**
66  Terminate delivering message thread.
67 
68  @return returns 0 if succeeds, error otherwise
69  */
70  int terminate();
71 
72  /**
73  Add to queue a new message to be deliver to recv service subscribers.
74 
75  @param[in] message message to be delivered
76  */
77  void add(Group_service_message *message);
78 
79  /**
80  It will notify recv subscribers with a service message.
81 
82  @param[in] service_message message to process
83 
84  @return false if message is delivered, true otherwise
85  */
87 
88  private:
89  /** Thread was terminated */
90  bool m_aborted;
91  /** The current phase */
93  /** The thread lock to control access */
95  /** The thread signal mechanism to be terminated */
97  /** The state of the thread. */
99  /** Queue with service message to be delivered */
101 };
102 
103 #endif /* MESSAGE_SERVICE_H */
Message_service_handler::m_message_service_pthd
my_thread_handle m_message_service_pthd
The current phase.
Definition: message_service.h:92
Message_service_handler::initialize
int initialize()
Initialize thread that will deliver messages.
Definition: message_service.cc:116
Message_service_handler::dispatcher
void dispatcher()
Main loop that checks message availability.
Definition: message_service.cc:146
mysql_mutex_t
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:49
Message_service_handler::m_message_service_run_lock
mysql_mutex_t m_message_service_run_lock
The thread lock to control access.
Definition: message_service.h:94
plugin_utils.h
my_thread_handle
Definition: my_thread_bits.h:51
thread_state
Definition: plugin_utils.h:42
Message_service_handler::add
void add(Group_service_message *message)
Add to queue a new message to be deliver to recv service subscribers.
Definition: message_service.cc:227
Message_service_handler::notify_message_service_recv
bool notify_message_service_recv(Group_service_message *service_message)
It will notify recv subscribers with a service message.
Definition: message_service.cc:244
Message_service_handler::~Message_service_handler
virtual ~Message_service_handler()
Definition: message_service.cc:96
Message_service_handler::terminate
int terminate()
Terminate delivering message thread.
Definition: message_service.cc:208
unregister_gr_message_service_send
bool unregister_gr_message_service_send()
Unregister default send message service.
Definition: message_service.cc:72
Message_service_handler
Definition: message_service.h:44
Message_service_handler::m_message_service_thd_state
thread_state m_message_service_thd_state
The state of the thread.
Definition: message_service.h:98
Abortable_synchronized_queue< Group_service_message * >
Message_service_handler::m_incoming
Abortable_synchronized_queue< Group_service_message * > * m_incoming
Queue with service message to be delivered.
Definition: message_service.h:100
Message_service_handler::Message_service_handler
Message_service_handler()
Create a message service handler to deliver messages to recv subscribers.
Definition: message_service.cc:87
mysql_cond_t
An instrumented cond structure.
Definition: mysql_cond_bits.h:49
Group_service_message
Definition: group_service_message.h:31
group_service_message.h
Message_service_handler::m_aborted
bool m_aborted
Thread was terminated.
Definition: message_service.h:90
register_gr_message_service_send
bool register_gr_message_service_send()
Register default send message service.
Definition: message_service.cc:55
service_implementation.h
Message_service_handler::m_message_service_run_cond
mysql_cond_t m_message_service_run_cond
The thread signal mechanism to be terminated.
Definition: message_service.h:96