自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(6)
  • 收藏
  • 关注

原创 java并发容器

30down voteacceparraylist和linkedlist 的 add(),remove(),iterator()在多线程访问下都需要加锁vector容器的add() remove() 操作是threadsafe,但iterator不是threadsafe,多线程使用下需要先锁CopyOnWriteArrayList,容器的 add,remove,itertor都是threadsaf...

2018-04-14 03:07:35 117

原创 epoll 水平触发 边缘触发

水平触发:只要缓冲区还有数据,内核就还会通知用户。用户如果第一次读取数据没读完,即使没有任何新的操作触发,还是可以继续通过epoll_wait来获取事件边缘触发:只有当新事件触发的时候,才能通过epoll_wait来获取数据,如果第一次读取数据没读完,就只能等待下一次事件触发来获取余下的数据。换句话说,即使缓冲区还有数据,但没有新事件触发,用户是获取不到事件的(不能读取余下数据)代

2017-01-24 20:26:12 404

转载 reactor模式 C++

我对reactor模式的理解是:先把任务放到acceptor那里 register,然后就先放着不动。等到这个任务被别人通知要做的时候,便去执行这个任务。详细可参考以下这篇文章http://www.dre.vanderbilt.edu/~schmidt/PDF/reactor-siemens.pdf以下这个博文也非常清晰地介绍了reactor的细节http://ww

2017-01-24 19:57:23 1758

原创 Asynchronous TCP server using coroutines

The server:#include #include #include #include #include #include #include #include #include namespace asio = boost::asio;typedef boost::shared_ptr socketptr;void handle_connection(a

2017-01-24 19:38:48 288

原创 Asynchronous programming using coroutines

sample code for Asynchronous programming using coroutines #include #include #include #include #include void wait_and_print(boost::asio::yield_context yield, boost::asio

2017-01-24 19:23:04 281

原创 c++ boost coroutine

For thread, the os help us schedule the thread automatically.For coroutine, we need to schedule the thread manually.There are benefits for coroutine over the thread. The os dont have to be b

2017-01-24 19:00:50 821

空空如也

空空如也

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

TA关注的人

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