- 博客(16)
- 资源 (1)
- 收藏
- 关注
原创 C++boost之asio strand
以c++ boost 1.66版本为例,类boost::asio::io_context::strand的主要作用是在asio中利用多线程进行事件处理的时候,如果涉及到多线程访问共享资源,借助于strand类,我们不需要显示的使用线程同步相关的类(比如mutex)就可以让多个事件处理函数依次执行。 简而言之,strand定义了事件处理程序的严格顺序调用。 我们知道,若多个线程调用了同一个io_...
2018-09-23 01:12:07
12425
5
原创 c++11之模板定义别名
C++11标准中可以为模板定义别名,比如 template<typename T> using ptr=std::shared_ptr<T>; //这里模板定义ptr<T>为智能指针std::shared_ptr<T>定义的别名 所以实际应用中可以借此来简化代码,比如 //gcc (GCC) 7.3.0 #include<memor...
2018-09-14 23:51:10
1123
转载 并发运行时与其他并发模型进行比较
摘自MSDN:点击打开链接 本文介绍了并发运行时与其他技术在功能和编程模型上的区别。 通过了解并发运行时与其他编程模型各自优点的比较,你可以选择最能满足应用程序要求的技术。 如果当前正在使用其他编程模型(例如 Windows 线程池或 OpenMP),可以在适当情况下迁移到并发运行时中。但是,如果你对应用程序性能和当前调试支持感到满意,则无需进行迁移。 可以使用并发运行时的功能和工
2017-08-16 11:35:27
401
转载 concurrency::parallel_for 计算两个方形矩阵的乘积
转自MSDN:点击打开链接 // compile with: /EHsc #include #include #include #include using namespace concurrency; using namespace std; // Calls the provided work function and returns the number of millisec
2017-08-15 16:09:21
1782
原创 STL Heap用法
#include #include #include #include #include using namespace std; void print(const vector& v,string info) { cout << info << ":"; std::copy(v.begin(), v.end(), std::ostream_iterator(cout, ","));
2017-08-05 01:05:41
346
原创 C++字符串和整数相互转换
//将整数转化为字符串,并且不使用itoa函数 #include void main() { int n = 12345; char temp[6] = {0}; int i = 0; while (n) { temp[i++] = n % 10 + '0';//整数加上‘0’隐性转化为char类型数 n /= 10; } char dst[6] = {0}; for (i
2017-08-04 22:25:26
3710
原创 GStreamer生成可播放的.264文件
命令:gst-launch-1.0 -e rtspsrc location=rtsp://admin:admin@192.168.1.2 ! rtph264depay ! "video/x-h264, stream-format=byte-stream" ! filesink location=test.264 说明:主要是用gst-lanuch工具连接相关插件将rtsp video strea
2016-09-30 11:45:21
4247
1
原创 Hibernate4.3.5之"hibernate.dialect" not set问题
"hibernate.dialect" not set问题
2014-07-22 15:30:26
1011
原创 迭代器模式
package lesson2; public class Demo6 { public static void main(String[] args) { MyArrayList list=new MyArrayList(); for(int i=0;i<10;++i) { list.add(new Cat(i)); } MyIterator iter=list.it
2014-07-09 14:54:09
461
原创 策略模式
package lesson10; public class Demo4 { public static void main(String[] args) { Dog[] dogs=new Dog[]{new Dog("d1",2),new Dog("d2",4),new Dog("d3",3)}; //MyArrays.sort(dogs); MyArrays.sort(dog
2014-07-03 23:41:22
434
原创 农场小母牛
package lesson6; import java.util.ArrayList; public class Demo11 { public static void main(String[] args) { ArrayList cows=new ArrayList(); Cow firstCow=new Cow(); firstCow.setAge(5); cows.a
2014-07-03 11:57:15
614
转载 el表达式获取cookie
${cookie.name}将获得对应cookie的对象,比如我们用jsp将一段cookie发送给客户端。 Cookie cookie = new Cookie("username", "Username in cookie"); response.addCookie(cookie); 创建一个名称为username,值为"Username in cookie"的Cookie对象,
2014-06-25 10:58:44
10203
live555 vs2010工程项目
2016-10-01
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅