自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Michael的专栏

大数据管理,数据库,分布式事务,图数据

  • 博客(8)
  • 收藏
  • 关注

翻译 什么是并发控制中的2PL

In this blog I will describe the concurrency control methods implemented in database management systems, and the differences between them. I will also explain about what locking technique is used in C

2016-03-28 08:51:34 2424

原创 使用libevent和多线程构建高性能服务器(客户端)

有问题可以联系我[email protected]因为开发数据库集群,节点需要通信,必须构建基于socket的C++网络通信系统。多年前使用UPD写过P2P流媒体,但是现在需要TPC,首先使用了Nanomsg作为网络库,但是开发过程中发现其不靠谱(模式太单一,并且出了问题根本找不到解决办法)。于是又掉头回来使用原生的socket编程。发现目前比较流行的(C++)网络编程使用libevent

2016-03-24 07:53:37 11196 3

翻译 如何理解wait前面需要加while循环

如何理解wait前面需要加while循环:pthread_mutex_lock(&m);while(!condition) pthread_cond_wait(&cond, &m);// Thread stuff herepthread_mutex_unlock(&m);The real reason you should put pthread_cond_wait

2016-03-19 07:07:12 3057

转载 pthread与std::thread对比用法

Threadstd::thread的构造函数方便得出人意料,这得感谢std::bind这个神奇的函数。在std::thread的构造函数里,你可以直接传递一个函数和这个函数的参数列表给这个线程。你甚至可以传递一个类成员函数。如果你这么做了,参数列表的第二个参数(第一个参数是被传递的成员函数)会被作为该类成员函数所作用的实例。是不是有点绕……举个例子来说吧:// 假设buy是一个可调用的

2016-03-19 07:05:56 14626 1

翻译 pthread_join和pthread_detach的用法

//从别处拷贝过来的,只作为自己查看方便,原作者不详,请谅解。一:关于joinjoinjoin是三种同步线程的方式之一。另外两种分别是互斥锁(mutex)和条件变量(condition variable)。调用pthread_join()将阻塞自己,一直到要等待加入的线程运行结束。可以用pthread_join()获取线程的返回值。一个线程对应一个pthread_joi

2016-03-18 02:06:32 562

原创 多线程中使用libevent

涉及到的API:1) evthread_use_pthreads()2) struct bufferevent *bev = bufferevent_socket_new(base, -1, BEV_OPT_CLOSE_ON_FREE | BEV_OPT_THREADSAFE);3) evbuffer_enable_locking(bev->output,n

2016-03-17 08:24:30 5351 1

翻译 C++智能指针作为成员变量的用法

I'm having trouble understanding the usage of smart pointers as class members in C++11. I have read a lot about smart pointers and I think I do understand howunique_ptr and shared_ptr/weak_ptr work

2016-03-05 09:50:29 4174

原创 C++中关于静态对象的使用( local static object and global static object)

先给出一个列子:class ThreadManager { public: // global singleton static ThreadManager &GetInstance(void);}// global singletonThreadManager &ThreadManager::GetInstance(void) { static Thre

2016-03-05 03:29:15 2337

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除