From b3b9d91eccd3f54be112ac5389b49969fea93b4c Mon Sep 17 00:00:00 2001
From: lichao <lichao@aiotlink.com>
Date: 星期三, 21 四月 2021 13:22:55 +0800
Subject: [PATCH] trivial.
---
.vscode/tasks.json | 7 ++-----
box/status_main.cc | 6 +++---
.vscode/launch.json | 2 +-
src/socket.cpp | 7 +------
src/shm_queue.cpp | 5 -----
5 files changed, 7 insertions(+), 20 deletions(-)
diff --git a/.vscode/launch.json b/.vscode/launch.json
index 939b9a9..dbcd519 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -14,7 +14,7 @@
"ApiTest"
],
"stopAtEntry": false,
- "cwd": "${workspaceFolder}",
+ "cwd": "${workspaceFolder}/debug",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
index db457e5..d07ebba 100644
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -4,12 +4,9 @@
"type": "cppbuild",
"label": "C/C++: g++ build active file",
"command": "ninja",
- "args": [
- "-C",
- "debug"
- ],
+ "args": [],
"options": {
- "cwd": "${workspaceFolder}"
+ "cwd": "${workspaceFolder}/debug"
},
"problemMatcher": [
"$gcc"
diff --git a/box/status_main.cc b/box/status_main.cc
index 3f075fb..3a0288b 100644
--- a/box/status_main.cc
+++ b/box/status_main.cc
@@ -62,8 +62,8 @@
int nkb = left / Kb;
int nb = left - nkb * Kb;
char buf[64] = {0};
- int n = sprintf(buf, " %4dMb %4dKb %4dB", nmb, nkb, nb);
- int start = (nmb > 0) ? 0 : ((nkb > 0) ? 7 : 14);
+ int n = sprintf(buf, " %4dM%4dK%4dB", nmb, nkb, nb);
+ int start = (nmb > 0) ? 0 : ((nkb > 0) ? 5 : 10);
buf[start] = sign;
return std::string(buf + start);
};
@@ -74,7 +74,7 @@
printf("%s", buf);
if (new_line) {
auto diff = cur - last;
- printf(" (%+ld = %s)\n", diff, Pretty(diff).c_str());
+ printf(" (%+6ld = %s)\n", diff, Pretty(diff).c_str());
printf("%s", buf);
}
fflush(stdout);
diff --git a/src/shm_queue.cpp b/src/shm_queue.cpp
index 78fdaec..df9ce1f 100644
--- a/src/shm_queue.cpp
+++ b/src/shm_queue.cpp
@@ -21,11 +21,6 @@
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
-// TODO !!! add garbage collection, and handshake with gc-center.
-// smart pointer will NOT work if user crash.
-// problem of process release mq: client query success; server exits; client send.
-// client query success; server exits; client send.
-
namespace bhome_shm
{
using namespace bhome_msg;
diff --git a/src/socket.cpp b/src/socket.cpp
index 1315474..c664982 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -24,11 +24,6 @@
using namespace bhome_msg;
using namespace bhome_shm;
-namespace
-{
-
-} // namespace
-
ShmSocket::ShmSocket(Shm &shm, const MQId &id, const int len) :
run_(false), mq_(id, shm, len)
{
@@ -42,7 +37,7 @@
ShmSocket::~ShmSocket()
{
- Stop(); //TODO should stop in sub class, incase thread access sub class data.
+ Stop();
}
bool ShmSocket::Start(int nworker, const RecvCB &onData, const IdleCB &onIdle)
--
Gitblit v1.8.0