list 对象 list 对象的定义 list对象内部是使用数组实现,在数组中存储的是指针,指向要保存的对象。 allocated是list中数组的大小,ob_size是当前已经使用的数组大小。 typedef?struct?{
????//?可变长对...
分类:
编程语言 时间:
2014-08-26 15:42:36
阅读次数:
361
题解:求区间K小,函数式线段树模板题。#include #include #include using namespace std;const int N=3000005;struct node{int num,id;}a[N];int T,n,m,x,y,z,tot,b[N],head[N],so...
分类:
其他好文 时间:
2014-08-26 15:25:46
阅读次数:
195
软件时钟
#include "global.h"
//时基函数结构体
typedef struct
{
uint16_t DelayTime;
uint16_t TimeBackup;
uint16_t Init;
}TIMER_T;
static volatile uint16_t u16Day; //日
static volatile uint16_t u1...
分类:
其他好文 时间:
2014-08-26 13:48:16
阅读次数:
164
本文为senlie原创,转载请保留此地址:http://blog.csdn.net/zhengsenlie
1.只让你进程调用 accept,然后把所接受的已连接套接字“传递”给某个子进程。
这样做就不用因为所有子进程都调用 accept 而需提供上锁保护
2.父进程必须跟踪子进程的忙闲状态,以便给空闲子进程传递新的套接字
typedef struct {
pid_t ...
分类:
其他好文 时间:
2014-08-26 13:46:56
阅读次数:
154
本文为senlie原创,转载请保留此地址:http://blog.csdn.net/zhengsenlie
1.预先创建一个线程池,并让每个线程各自调用 accept
2.用互斥锁取代让每个线程都阻塞在 accept 调用之中的做法
//用于维护关于每个线程基于信息的 Thread 结构
typedef struct {
pthread_t thread_tid; ...
分类:
编程语言 时间:
2014-08-26 13:46:16
阅读次数:
321
这里没再用到先申请大Node数组的方法了,想练练写动态内存分配和释放的,一次OK了,也没怎么出错啊,开心~
方法二 - Code:
//给出一个二叉树的先序遍历和中序遍历,输出它的后序遍历
//直接构造的方法白书已给出。这里是先递归构造二叉树,然后进行后序遍历。
#include
#include
#include
#define MAXN 1000
typedef struct nod...
分类:
其他好文 时间:
2014-08-26 13:42:56
阅读次数:
253
将序列中的数字每次+1或-1,最少的次数形成非递减序列#include #include #include using namespace std;struct node{ int Left, Right, Height; vector Lower;};typedef long long...
分类:
其他好文 时间:
2014-08-26 13:30:56
阅读次数:
178
题目大意:空间中有许多无限长的棒子(圆柱体),求棒子间最小距离。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const double eps = 1e-8; 8 struct Point3/...
分类:
其他好文 时间:
2014-08-26 13:28:06
阅读次数:
157
从sdk3.2.5升级到sdk 5.1中间废弃了很多的方法,还有一些逻辑关系更加严谨了。1,警告:“xoxoxoxo” is deprecated解决办法:查看xoxoxoxo的这个方法的文档,替换掉这个方法即可。2,警告:Declaration of "struct sockaddr" will ...
分类:
其他好文 时间:
2014-08-26 13:05:56
阅读次数:
232
skynet 利用内置的原子操作来实现的一个读写锁,重点是理解 ”full memory barrier“ ,UNPv2 中利用互斥和条件变量实现的读写锁。前者是在硬件支持的情况下,显得简单明了,站的层次不一样。
源码贴出来:
struct rwlock {
int write;
int read;
};
static inline void
rwlock_in...
分类:
Web程序 时间:
2014-08-26 11:43:26
阅读次数:
284