2013年4月16日

说下C中的定时

摘要: 因为项目的需要,最近研究实时性很多,包括实时操作系统,线程优先级调度等等,其中一个很重要的地方就是定时器的研究。以下说的环境都在Linux下。首先说下Linux下的一般较精确的定时吧,setitimer函数,1 #include <sys/time.h>2 int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue);which参数指定了选用的时钟类型,与时钟类型对应的也决定了时钟产生的信号,可以使用的时钟类型如下:ITIMER_REAL定时真实时间,与alarm类型相同。SIGA 阅读全文

posted @ 2013-04-16 10:21 crayzero 阅读(430) 评论(0) 推荐(0)

2013年4月15日

C++学习随笔1

摘要: C++继承与动态问题C++中派生类继承基类的时候可以指定继承的类别如public,private,protected。各个继承的含义不多说了。今天遇到一件有意思的事:源代码:Item_base.h:#include <string>#include <iostream>using namespace std;class Item_base{public: Item_base(const std::string &book="",double sales_price=0.0):isbn(book),price(sales_price){} st 阅读全文

posted @ 2013-04-15 08:53 crayzero 阅读(267) 评论(2) 推荐(0)

导航