mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2025-12-06 16:56:45 +08:00
简化接口
This commit is contained in:
parent
1323dc736b
commit
7545e17084
@ -1,19 +1,19 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <regex>
|
||||
#include <atomic>
|
||||
|
||||
#include "libipc/ipc.h"
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr char const name__[] = "ipc-msg-que";
|
||||
constexpr char const quit__[] = "q";
|
||||
constexpr char const id__ [] = "c";
|
||||
constexpr char const mode_s__[] = "s";
|
||||
constexpr char const mode_r__[] = "r";
|
||||
|
||||
using msg_que_t = ipc::chan<ipc::relat::single, ipc::relat::single, ipc::trans::unicast>;
|
||||
|
||||
} // namespace
|
||||
|
||||
int main() {
|
||||
int main(int argc, char ** argv) {
|
||||
if (argc < 2) return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -140,8 +140,8 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Flag>
|
||||
using chan = chan_wrapper<Flag>;
|
||||
template <relat Rp, relat Rc, trans Ts>
|
||||
using chan = chan_wrapper<ipc::wr<Rp, Rc, Ts>>;
|
||||
|
||||
/*
|
||||
* class route
|
||||
@ -154,7 +154,7 @@ using chan = chan_wrapper<Flag>;
|
||||
* (one producer/writer to multi consumers/readers)
|
||||
*/
|
||||
|
||||
using route = chan<ipc::wr<relat::single, relat::multi, trans::broadcast>>;
|
||||
using route = chan<relat::single, relat::multi, trans::broadcast>;
|
||||
|
||||
/*
|
||||
* class channel
|
||||
@ -164,6 +164,6 @@ using route = chan<ipc::wr<relat::single, relat::multi, trans::broadcast>>;
|
||||
* would receive your sent messages.
|
||||
*/
|
||||
|
||||
using channel = chan<ipc::wr<relat::multi, relat::multi, trans::broadcast>>;
|
||||
using channel = chan<relat::multi, relat::multi, trans::broadcast>;
|
||||
|
||||
} // namespace ipc
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
#include "libipc/waiter_helper.h"
|
||||
|
||||
#include "libipc/utility/log.h"
|
||||
#include "libipc/utility/scope_guard.h"
|
||||
#include "libipc/platform/detail.h"
|
||||
#include "libipc/memory/resource.h"
|
||||
|
||||
|
||||
@ -13,7 +13,6 @@
|
||||
#include "libipc/waiter_helper.h"
|
||||
|
||||
#include "libipc/utility/log.h"
|
||||
#include "libipc/utility/scope_guard.h"
|
||||
#include "libipc/platform/to_tchar.h"
|
||||
#include "libipc/platform/get_sa.h"
|
||||
#include "libipc/platform/detail.h"
|
||||
|
||||
@ -52,7 +52,7 @@ public:
|
||||
|
||||
template <relat Rp, relat Rc, trans Ts>
|
||||
void test_basic(char const * name) {
|
||||
using que_t = chan<wr<Rp, Rc, Ts>>;
|
||||
using que_t = chan<Rp, Rc, Ts>;
|
||||
rand_buf test1, test2;
|
||||
|
||||
que_t que1 { name };
|
||||
@ -69,7 +69,7 @@ void test_basic(char const * name) {
|
||||
|
||||
template <relat Rp, relat Rc, trans Ts>
|
||||
void test_sr(char const * name, int size, int s_cnt, int r_cnt) {
|
||||
using que_t = chan<wr<Rp, Rc, Ts>>;
|
||||
using que_t = chan<Rp, Rc, Ts>;
|
||||
|
||||
ipc_ut::sender().start(static_cast<std::size_t>(s_cnt));
|
||||
ipc_ut::reader().start(static_cast<std::size_t>(r_cnt));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user