- 博客(6)
- 资源 (10)
- 收藏
- 关注
原创 select_stdin.c
1、fgets()参数里,stdin用0代替,会出现 'Segmentation fault' 。对stdout stdin stderr 不了解。2、当敲入键盘,但没有按下回车键时,程序还是会阻塞在select()里。3、用memcpy()代替strcmp()做字符串比较。且注意比较字符数是strlen()减 1 。// NAME: select_stdin.c#include #include // exit()#include // bzero()#inclu
2011-05-31 14:49:00 783
原创 用signal结束多个线程
在创建多线程时,有时可能几个线程里面都是死循环,如果结束这些线程呢?可以用signal(),这里介绍signal的一个应用。当然,不用signal(),按Ctrl+C也可以直接结束。// file name:signal_to_stop_thread.c// 接收到特定的信号量,结束多个线程#include #include #include #include #include //typedef int bool;#define MY_FALSE 0#d
2011-05-25 17:57:00 1446
原创 c调用c++,一个makefile例子
c调用c++,总的目标,是用g++编译生成的// File Name: test_cpp.h#ifndef TEST_CPP_H#define TEST_CPP_Hextern "C" void c_call_cpp_printf(char* str);class TestCpp{public: TestCpp(char* p_char_p); ~TestCpp(); void test_cpp_printf();private: char
2011-05-23 14:41:00 883
原创 assert使用
<br />多用assert,能很好找到程序出错位置。<br />// assert.c#include <stdio.h>#include <stdlib.h>#include <string.h>/* 断言。当f为假时,输出当前断言的表达式,及代码所在位置的信息(函数名、源文件名、行号),并退出程序,返回-1。 */#define ASSERT()/ printf("__funtion__:%s(), __file__:%s, __line__:%d/n",__func_
2011-05-23 14:30:00 698
原创 phy device的添加流程
phy device的添加流程,了解linux驱动中的 驱动、设备、总线 模型。 87 int mdiobus_register(struct mii_bus *bus) 88 {// 省略。。。。。。115 for (i = 0; i phy_mask & (1
2011-05-04 17:47:00 4285 1
原创 davinci_emac_probe是怎样被执行的?
分析linux-2.6.32/driver/net/davinci_emac.c 的davinci_emac_probe()是怎样被调用的,了解驱动模块。2827 static int __init davinci_emac_init(void)2828 {2829 return platform_driver_register(&davinci_emac_driver);2830 }platform_driver_register()主要调用 driver_register()
2011-05-04 17:32:00 1414
linux c++线程
2010-08-26
如何实现最小的RTSP服务器
2010-06-03
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人