muduo
lsaejn
这个作者很懒,什么都没留下…
展开
-
muduo库源码学习(base):WeakCallback
// Copyright 2010, Shuo Chen. All rights reserved.// http://code.google.com/p/muduo///// Use of this source code is governed by a BSD-style license// that can be found in the License file.////原创 2017-11-14 21:32:08 · 1487 阅读 · 1 评论 -
muduo库源码学习(base):LogStream
#ifndef MUDUO_BASE_LOGSTREAM_H#define MUDUO_BASE_LOGSTREAM_H#include #include #include #include // memcpy#ifndef MUDUO_STD_STRING#include #endifnamespace muduo{namespace detail{const原创 2017-11-14 21:19:21 · 475 阅读 · 0 评论 -
muduo库源码学习(base):Logfile
本文件使用的是C++17版本#ifndef MUDUO_BASE_LOGFILE_H#define MUDUO_BASE_LOGFILE_H#include #include #include namespace muduo{namespace FileUtil{class AppendFile;}class LogFile : noncopyable//文件日原创 2017-11-14 19:13:51 · 391 阅读 · 0 评论 -
muduo库源码学习(base)ThreadLocalSingleton
// Use of this source code is governed by a BSD-style license// that can be found in the License file.//// Author: Shuo Chen (chenshuo at chenshuo dot com)#ifndef MUDUO_BASE_THREADLOCALSINGLETON_原创 2017-11-05 00:41:49 · 244 阅读 · 0 评论 -
muduo库源码学习(base)ThreadLocal
// Use of this source code is governed by a BSD-style license// that can be found in the License file.//// Author: Shuo Chen (chenshuo at chenshuo dot com)#ifndef MUDUO_BASE_THREADLOCAL_H#define原创 2017-11-05 00:34:37 · 214 阅读 · 0 评论 -
muduo库源码学习(base)Date
muduo在时间上选择的是tm和timeSpecstruct tm;namespace muduo{//// Date in Gregorian calendar.//// This class is immutable.// It's recommended to pass it by value, since it's passed in register on x64.原创 2017-10-26 12:07:04 · 369 阅读 · 0 评论 -
muduo库源码学习(base)Thread和CurrentThread
//CurrentThread,定义了一些辅助函数namespace muduo{namespace CurrentThread{ // internal extern __thread int t_cachedTid; extern __thread char t_tidString[32]; extern __thread int t_tidStringLength;原创 2017-10-26 11:38:02 · 1224 阅读 · 0 评论 -
muduo库源码学习(base)Condition
#ifndef MUDUO_BASE_CONDITION_H#define MUDUO_BASE_CONDITION_H#include "./Mutex.h"#include #include namespace muduo{class Condition : boost::noncopyable{ public: explicit Condition(MutexL原创 2017-10-25 14:55:09 · 217 阅读 · 0 评论 -
muduo库源码学习(base)BlockingQueue和BoundBlockingQueue
#include "./Condition.h"#include "./Mutex.h"#include #include #include namespace muduo{templateclass BlockingQueue : boost::noncopyable//为多线程准备的队列{ public: BlockingQueue() : mutex_(原创 2017-10-25 13:52:52 · 216 阅读 · 0 评论 -
muduo库源码学习(base)singleton
/*SFINAE的意思是这样的,假如有一个特化会导致编译时错误(即出现编译失败),只要还有别的选择可以被选择,那么就无视这个特化错误而去选择另外的可选选择。这个示例中,如果我们给传的参数T类型为POD类型,当调用detail::has_no_destroy::value时,T参数会在has_no_destroy类中实例化模板,由于是POD类型,不具备no_destroy方法,不原创 2017-10-31 22:32:31 · 471 阅读 · 0 评论 -
muduo库源码学习(base)mutex
class MutexLock : boost::noncopyable//最常用的类.就是std::mutex,对应的还是lock_guard和unique_lock{ public: MutexLock() : holder_(0) { MCHECK(pthread_mutex_init(&mutex_, NULL)); } ~MutexLock()原创 2017-10-31 22:24:14 · 249 阅读 · 0 评论 -
muduo库源码学习(base)FileUtil
class ReadSmallFile : boost::noncopyable{ public: ReadSmallFile(StringArg filename); ~ReadSmallFile(); // return errno template int readToString(int maxSize,//最大的长度 Str原创 2017-10-31 21:31:03 · 337 阅读 · 0 评论 -
muduo库源码学习(base)Exception
class Exception : public std::exception{ public: explicit Exception(const char* what); explicit Exception(const string& what); virtual ~Exception() throw(); virtual const char* what() const原创 2017-10-31 21:22:14 · 249 阅读 · 0 评论 -
muduo库源码学习(base)AsyncLogging
//前端写缓冲区,2块缓冲,不够就写到容器。后端两块缓冲区,加上一个容器,用于和前端的容器swapclass AsyncLogging : boost::noncopyable{ public: AsyncLogging(const string& basename, size_t rollSize,//log文件临界大小,存下之后超出它的话,则滚动文件原创 2017-09-28 19:56:56 · 450 阅读 · 0 评论 -
muduo库源码学习(base)Atomic
/*完成原子类型的封装*/templateclass AtomicIntegerT : boost::noncopyable{ public: AtomicIntegerT() : value_(0) { } // uncomment if you need copying and assignment // // AtomicIntegerT(const原创 2017-09-14 12:44:03 · 277 阅读 · 0 评论 -
使用VS2017的跨平台项目进行linux开发
以编译base为例,基本过程如下:搭建好Linux平台环境,安装boost等,(好像需要拷贝linux下的头文件到windows下,这个忘了)代码里的头文件全部改成“./*.h”(试过不修改代码,但是添加目录的方法全失败了,我也不知道为什么)项目类型选择静态库.a然后。。。。编译通过,如此简单,以至于没什么可写的。接下来像windows一样,使用这个库。过程如下原创 2017-09-13 17:25:12 · 11760 阅读 · 0 评论