no message
parent
8ac3df8244
commit
9fd67c1fc3
|
@ -28,7 +28,7 @@ int PrintDumpObjvoid (void *dst,int rowNum,int num,bool ifAsii){
|
||||||
}
|
}
|
||||||
snprintf(out,5,"LN: ");
|
snprintf(out,5,"LN: ");
|
||||||
for (int z = 1;z < rowNum + 1; z++) {
|
for (int z = 1;z < rowNum + 1; z++) {
|
||||||
char tmp[4] = {0};
|
char tmp[6] = {0};
|
||||||
sprintf(tmp,"%02d ",z);
|
sprintf(tmp,"%02d ",z);
|
||||||
strcat(out,tmp);
|
strcat(out,tmp);
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ int PrintDumpObjvoid (void *dst,int rowNum,int num,bool ifAsii){
|
||||||
|
|
||||||
if (ifAsii) {
|
if (ifAsii) {
|
||||||
for (int z = 1;z < rowNum + 1; z++) {
|
for (int z = 1;z < rowNum + 1; z++) {
|
||||||
char tmp[4] = {0};
|
char tmp[6] = {0};
|
||||||
sprintf(tmp,"%02d ",z);
|
sprintf(tmp,"%02d ",z);
|
||||||
strcat(out,tmp);
|
strcat(out,tmp);
|
||||||
}
|
}
|
||||||
|
@ -44,13 +44,13 @@ int PrintDumpObjvoid (void *dst,int rowNum,int num,bool ifAsii){
|
||||||
strcat(out,"\r\n");
|
strcat(out,"\r\n");
|
||||||
for(int i = 0;i < row;i ++) {
|
for(int i = 0;i < row;i ++) {
|
||||||
string rowstr;
|
string rowstr;
|
||||||
char tmp[3] = {0};
|
char tmp[6] = {0};
|
||||||
sprintf(tmp,"%02x",i + 1);
|
sprintf(tmp,"%02x",i + 1);
|
||||||
rowstr += string(tmp) + ": ";
|
rowstr += string(tmp) + ": ";
|
||||||
//last row
|
//last row
|
||||||
if (i == row -1 && left != 0){
|
if (i == row -1 && left != 0){
|
||||||
for (int z = 0;z < rowNum; z++) {
|
for (int z = 0;z < rowNum; z++) {
|
||||||
char tmp[3] = {0};
|
char tmp[6] = {0};
|
||||||
if (z < left){
|
if (z < left){
|
||||||
sprintf(tmp,"%02x",((unsigned char)(((unsigned char *)dst)[ z + i * rowNum])));
|
sprintf(tmp,"%02x",((unsigned char)(((unsigned char *)dst)[ z + i * rowNum])));
|
||||||
}else{
|
}else{
|
||||||
|
@ -65,7 +65,7 @@ int PrintDumpObjvoid (void *dst,int rowNum,int num,bool ifAsii){
|
||||||
rowstr += " ";
|
rowstr += " ";
|
||||||
if(ifAsii) {
|
if(ifAsii) {
|
||||||
for (int z = 0;z < left; z++) {
|
for (int z = 0;z < left; z++) {
|
||||||
char tmp[3] = {0};
|
char tmp[6] = {0};
|
||||||
sprintf(tmp,"%c",((unsigned char)(((unsigned char *)dst)[ z + i * rowNum])));
|
sprintf(tmp,"%c",((unsigned char)(((unsigned char *)dst)[ z + i * rowNum])));
|
||||||
rowstr += string(tmp) + " ";
|
rowstr += string(tmp) + " ";
|
||||||
if (z == left - 1){
|
if (z == left - 1){
|
||||||
|
@ -75,7 +75,7 @@ int PrintDumpObjvoid (void *dst,int rowNum,int num,bool ifAsii){
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
for (int z = 0;z < rowNum; z++) {
|
for (int z = 0;z < rowNum; z++) {
|
||||||
char tmp[3] = {0};
|
char tmp[6] = {0};
|
||||||
sprintf(tmp,"%02x",((unsigned char)(((unsigned char *)dst)[ z + i * rowNum])));
|
sprintf(tmp,"%02x",((unsigned char)(((unsigned char *)dst)[ z + i * rowNum])));
|
||||||
rowstr += string(tmp) + " ";
|
rowstr += string(tmp) + " ";
|
||||||
if (!ifAsii){
|
if (!ifAsii){
|
||||||
|
@ -84,10 +84,10 @@ int PrintDumpObjvoid (void *dst,int rowNum,int num,bool ifAsii){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rowstr += " ";
|
|
||||||
if(ifAsii){
|
if(ifAsii){
|
||||||
|
rowstr += " ";
|
||||||
for (int z = 0;z < rowNum; z++) {
|
for (int z = 0;z < rowNum; z++) {
|
||||||
char tmp[1] = {0};
|
char tmp[6] = {0};
|
||||||
sprintf(tmp,"%c",((unsigned char)(((unsigned char *)dst)[ z + i * rowNum])));
|
sprintf(tmp,"%c",((unsigned char)(((unsigned char *)dst)[ z + i * rowNum])));
|
||||||
rowstr += string(tmp) + " ";
|
rowstr += string(tmp) + " ";
|
||||||
if (z == rowNum - 1){
|
if (z == rowNum - 1){
|
||||||
|
@ -129,13 +129,13 @@ int dumpObj(void *dst,int rowNum,int num,bool ifAsii,char *out) {
|
||||||
strcat(out,"\r\n");
|
strcat(out,"\r\n");
|
||||||
for(int i = 0;i < row;i ++) {
|
for(int i = 0;i < row;i ++) {
|
||||||
string rowstr;
|
string rowstr;
|
||||||
char tmp[3] = {0};
|
char tmp[4] = {0};
|
||||||
sprintf(tmp,"%02x",i + 1);
|
sprintf(tmp,"%02x",i + 1);
|
||||||
rowstr += string(tmp) + ": ";
|
rowstr += string(tmp) + ": ";
|
||||||
//last row
|
//last row
|
||||||
if (i == row -1 && left != 0){
|
if (i == row -1 && left != 0){
|
||||||
for (int z = 0;z < rowNum; z++) {
|
for (int z = 0;z < rowNum; z++) {
|
||||||
char tmp[3] = {0};
|
char tmp[4] = {0};
|
||||||
if (z < left){
|
if (z < left){
|
||||||
sprintf(tmp,"%02x",((unsigned char)(((unsigned char *)dst)[ z + i * rowNum])));
|
sprintf(tmp,"%02x",((unsigned char)(((unsigned char *)dst)[ z + i * rowNum])));
|
||||||
}else{
|
}else{
|
||||||
|
@ -150,7 +150,7 @@ int dumpObj(void *dst,int rowNum,int num,bool ifAsii,char *out) {
|
||||||
rowstr += " ";
|
rowstr += " ";
|
||||||
if(ifAsii) {
|
if(ifAsii) {
|
||||||
for (int z = 0;z < left; z++) {
|
for (int z = 0;z < left; z++) {
|
||||||
char tmp[3] = {0};
|
char tmp[4] = {0};
|
||||||
sprintf(tmp,"%c",((unsigned char)(((unsigned char *)dst)[ z + i * rowNum])));
|
sprintf(tmp,"%c",((unsigned char)(((unsigned char *)dst)[ z + i * rowNum])));
|
||||||
rowstr += string(tmp) + " ";
|
rowstr += string(tmp) + " ";
|
||||||
if (z == left - 1){
|
if (z == left - 1){
|
||||||
|
@ -172,7 +172,7 @@ int dumpObj(void *dst,int rowNum,int num,bool ifAsii,char *out) {
|
||||||
rowstr += " ";
|
rowstr += " ";
|
||||||
if(ifAsii){
|
if(ifAsii){
|
||||||
for (int z = 0;z < rowNum; z++) {
|
for (int z = 0;z < rowNum; z++) {
|
||||||
char tmp[1] = {0};
|
char tmp[4] = {0};
|
||||||
sprintf(tmp,"%c",((unsigned char)(((unsigned char *)dst)[ z + i * rowNum])));
|
sprintf(tmp,"%c",((unsigned char)(((unsigned char *)dst)[ z + i * rowNum])));
|
||||||
rowstr += string(tmp) + " ";
|
rowstr += string(tmp) + " ";
|
||||||
if (z == rowNum - 1){
|
if (z == rowNum - 1){
|
||||||
|
|
|
@ -17,7 +17,6 @@ namespace general{
|
||||||
CThreadPool::CThreadPool(int num) {
|
CThreadPool::CThreadPool(int num) {
|
||||||
this->mThreadCnt = num;
|
this->mThreadCnt = num;
|
||||||
mStarted = false;
|
mStarted = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CThreadPool::AddTask(Task *t) {
|
int CThreadPool::AddTask(Task *t) {
|
||||||
|
@ -126,4 +125,3 @@ namespace general{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,40 @@
|
||||||
#include "loger.h"
|
#include "loger.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
#pragma pack(4)
|
||||||
|
typedef struct test1{
|
||||||
|
uint32_t a ;
|
||||||
|
uint32_t b;
|
||||||
|
char c;
|
||||||
|
}Test1;
|
||||||
|
#pragma pack()
|
||||||
|
|
||||||
|
#pragma pack(1)
|
||||||
|
typedef struct testsize2{
|
||||||
|
uint16_t a;
|
||||||
|
uint8_t b;
|
||||||
|
uint32_t c;
|
||||||
|
}Test2;
|
||||||
|
#pragma pack()
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
|
std::cout<<sizeof(Test1) << " "<< sizeof(Test2)<<std::endl;
|
||||||
|
Test1 x = Test1{
|
||||||
|
1,2,3
|
||||||
|
};
|
||||||
|
Test2 y = Test2{
|
||||||
|
1,2,3
|
||||||
|
};
|
||||||
|
char result[1000] = {0};
|
||||||
|
PrintDumpObjvoid(&x,6,sizeof(Test1),false);
|
||||||
|
dumpObj(&y,6,sizeof(Test2),true,result);
|
||||||
|
std::cout<<result<<std::endl;
|
||||||
|
|
||||||
Loger loger1("d://","test",true);
|
Loger loger1("d://","test",true);
|
||||||
loger1.Debug("hello",DEBUG_FILE_POSITION);
|
loger1.SetMinimalLevel(LEVEL_DEBUG);
|
||||||
|
loger1.Debug("hello",FILE_POSITION);
|
||||||
loger1<< "12131";
|
loger1<< "12131";
|
||||||
loger1 + "12121";
|
loger1 + "12121";
|
||||||
loger1.Debug("hello11212",DEBUG_FILE_POSITION);
|
loger1.Debug("hello11212",FILE_POSITION);
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ int TestOptiomization() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int TestRValue() {
|
int TestRValue() {
|
||||||
std::string str = "Hello";
|
std::string str = "Hello";
|
||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
//调用常规的拷贝构造函数,新建字符数组,拷贝数据
|
//调用常规的拷贝构造函数,新建字符数组,拷贝数据
|
||||||
|
@ -267,13 +267,14 @@ class ASyncProcess {
|
||||||
std::cout<<"ASyncProcess construct"<<std::endl;
|
std::cout<<"ASyncProcess construct"<<std::endl;
|
||||||
mThread = new std::thread([this,t,&ret](){
|
mThread = new std::thread([this,t,&ret](){
|
||||||
ret = t();
|
ret = t();
|
||||||
|
mMutex.lock();
|
||||||
this->m_finish = true;
|
this->m_finish = true;
|
||||||
|
mMutex.unlock();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
bool Finish(){
|
bool Finish(){
|
||||||
return m_finish;
|
return m_finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~ASyncProcess() {
|
virtual ~ASyncProcess() {
|
||||||
mThread->detach();
|
mThread->detach();
|
||||||
}
|
}
|
||||||
|
@ -281,7 +282,6 @@ class ASyncProcess {
|
||||||
bool m_finish = false;
|
bool m_finish = false;
|
||||||
std::thread *mThread;
|
std::thread *mThread;
|
||||||
std::mutex mMutex;
|
std::mutex mMutex;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename R, typename... Args>
|
template<typename R, typename... Args>
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "threadpool.h"
|
#include "threadpool.h"
|
||||||
// 参考于https://www.cnblogs.com/bigosprite/p/11071462.html
|
|
||||||
|
|
||||||
unsigned int CoreCount()
|
unsigned int CoreCount()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue