We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b808671 commit 50ea6baCopy full SHA for 50ea6ba
1 file changed
section5/Zmq.hpp
@@ -0,0 +1,36 @@
1
+// Copyright (c) 2020 by Chrono
2
+
3
+#ifndef _SPIN_LOCK_HPP
4
+#define _SPIN_LOCK_HPP
5
6
+#include "cpplang.hpp"
7
8
+#include <zmq.hpp>
9
10
+BEGIN_NAMESPACE(cpp_study)
11
12
+template<int thread_num = 1>
13
+class ZmqContext final
14
+{
15
+public:
16
+ using zmq_context_type = zmq::context_t;
17
+ using zmq_socket_type = zmq::socket_t;
18
+ using zmq_message_type = zmq::message_t;
19
20
+ static
21
+ zmq_context_type& context()
22
+ {
23
+ static zmq_context_type ctx(thread_num);
24
+ return ctx;
25
+ }
26
27
+ zmq_socket_type socket(int mode) const
28
29
+ return zmq_socket_type(context(), mode);
30
31
+};
32
33
+END_NAMESPACE(cpp_study)
34
35
+#endif //_SPIN_LOCK_HPP
36
0 commit comments