Chinaunix首页 | 论坛 | 博客
  • 博客访问: 33835
  • 博文数量: 8
  • 博客积分: 25
  • 博客等级: 民兵
  • 技术积分: 131
  • 用 户 组: 普通用户
  • 注册时间: 2010-06-27 20:12
文章分类

全部博文(8)

文章存档

2013年(8)

我的朋友

发布时间:2013-02-26 22:18:44

多线程队列(Concurrent Queue)的使用场合非常多,高性能服务器中的消息队列,并行算法中的Work Stealing等都离不开它。对于一个队列来说有两个最主要的动作:添加(enqueue)和删除(dequeue)节点。在一个(或多个)线程在对一个队列进行enqueue操作的同时可能会有一个(或多个)线程对这个队列进行dequeue操作。因为e.........【阅读全文】

阅读(1492) | 评论(0) | 转发(0)

发布时间:2013-02-20 23:34:14

#include <stdio.h>#include <stdint.h>/** * Copy 16 bytes from one location to another using optimised SSE * instructions. The locations should not overlap. * * @param s1 * Pointer to the destination of the data. * @param s2 * Pointer to the source data. */static inline voidmov16(uint.........【阅读全文】

阅读(2625) | 评论(0) | 转发(0)

发布时间:2013-02-20 22:32:25

以下代码,未注释,未编译,未验证#ifndef __TPOOL_H__#define __TPOOL_H__#define MAX_QUEUE_DEPTH 128typedef void *(*thread_func)(void *);typedef struct work_args_t{thread_func func;void *agrs;} work_args_t;typedef struct s_work_index_t{    long long       &n.........【阅读全文】

阅读(1970) | 评论(0) | 转发(0)

发布时间:2013-02-20 22:28:09

以下代码未注释,未编译,未验证正确性#define MAX_LIST 1024 typedef struct {    char *data;    int isuse;}data_t;typedef struct{    data_t data[MAX_LIST];    int index;    pthread_mutex_t mutex;} wait_list;wait_list * getwaitl.........【阅读全文】

阅读(1153) | 评论(0) | 转发(0)

发布时间:2013-02-04 22:29:11

Prototype 模式   Prot otype 模式主要解决浅层拷贝和深层拷贝的问题,但是一般不是太差的程序员一般都可以避免这种错误。 个人认为它蕴含着一生二, 二生四的太极思想,但是在c语言中怎么实现,有什么应用场景呢?先给上代码typedef char.........【阅读全文】

阅读(2220) | 评论(0) | 转发(0)
给主人留下些什么吧!~~
留言热议
请登录后留言。

登录 注册