- 博客(7)
- 资源 (1)
- 收藏
- 关注
原创 pthread_cond_wait()学习
<br />1、产生原因:<br />互斥对象是线程程序必需的工具,但它们并非万能的。例如,如果线程正在等待共享数据内某个条件出现,那会发生什么呢?代码可以反复对互斥对象锁定和解锁,以检查值的任何变化。同时,还要快速将互斥对象解锁,以便其它线程能够进行任何必需的更改。这是一种非常可怕的方法,因为线程需要在合理的时间范围内频繁地循环检测变化。<br />条件变量由此诞生!<br />2、示例:<br />#include <stdio.h> #include <pthread.h> #include <s
2010-11-19 17:45:00 481
原创 epoll学习
<br />目录<br />一、函数原语... 1<br />二、结构体... 1<br />三、二种模式... 1<br />四、简单例子... 1<br /> 一、函数原语<br />int epoll_create(int size);<br />int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event);<br />int epoll_wait(int epfd, struct epoll_event * events, in
2010-11-19 11:54:00 482
原创 c语言实现的简单二叉树
<br />#include <stdio.h> #include <stdlib.h> typedef struct node * link; struct node{ int item; link l; link r; }; link make_node(int item, link l, link r) { link t = (link)malloc(sizeof(*t)); t->item = item; t->l = l; t->r = r; r
2010-09-19 18:10:00 671
原创 C#中结构体与字节流互相转换
一、c#结构体1、定义与C++对应的C#结构体<br />在c#中的结构体不能定义指针,不能定义字符数组,只能在里面定义字符数组的引用。<br />C++的消息结构体如下:<br />//消息格式 4+16+4+4= 28个字节<br />struct cs_message{<br /> u32_t cmd_type;<br /> charusername[16];<br /> u32_t dstID;<br />
2010-08-31 15:29:00 9986 8
原创 c++实现的循环队列和栈
#ifndef _QUEUE_H_ #define _QUEUE_H_ class CQueue{ private: int *Q; int size; int len; int head; int tail; public: CQueue(int size = 16) { this->size = size; this->Q = new int[size]; this->len = 0; this->head = 0; this->ta
2010-08-20 14:21:00 831
原创 C++实现的单链表
#include #include class CNode { private: int item; CNode *next; public: CNode(int item = 0, CNode *next = NULL) { this->item = item; this->next = next; } ~CNode(){} friend class CList; }; class CList { private: CNode
2010-08-19 19:51:00 494
原创 vc截屏并传出位图首地址
<br />char *bmp_buffer;<br />bmp_buffer = new[1024 * 768];<br /> <br />void CaptureScreen2()<br />{<br /> int w = GetSystemMetrics(SM_CXSCREEN);<br /> int h = GetSystemMetrics(SM_CYSCREEN);<br /> HDC hDesktopDC = ::GetDC(NULL);<br /> HDC hCaptu
2010-07-16 18:23:00 825
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人