自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(10)
  • 收藏
  • 关注

原创 线程池的简单实现

threadpool.h#ifndef _THREAD_POOL_H#define _THREAD_POOL_H#include <deque>#include <pthread.h>#include <string>#include <string.h>#include <stdlib.h>namespace Z1...

2020-05-07 17:04:34 215

原创 堆的C实现

heap.h#ifndef _HEAP_H#define _HEAP_Htypedef struct{ int *ptData; int maxSize; int size;}T_Heap;#endifheap.cpp#include "heap.h"#include <stdio.h>#include <stdlib.h>#incl...

2020-05-03 12:44:44 205

原创 排序算法

#include<iostream>#include<cstdio>#include<cstring>using namespace std;#define MAX_N 1000000int n;int a[MAX_N];void swap(int &a, int &b){ int temp = a; ...

2020-05-01 18:15:09 207

原创 哈希

#include <iostream>#include <cstdlib>#include <cstring>using namespace std;template<class T> class hash;template<>class hash<string>{public: size_t ...

2020-04-28 09:07:39 191

原创 跳表skiplist相关

基于字典的跳表实现#include <iostream>#include <cstdio>#include <cstdlib>#include <cmath>#include <ctime>using namespace std;template <class K, class E>struct sk...

2020-04-26 11:44:45 129

原创 shmc共享内存相关

1.shm_open简单的使用#include <sys/stat.h>#include <unistd.h>#include <stdio.h>#include <stdlib.h>#include <sys/mman.h>#include <fcntl.h>#include <errno.h>...

2020-04-22 14:03:53 746

原创 mmap内存映射相关例程

1.父进程子进程通过mmap内存映射来往一个文件里写int类型对象的计数#include <semaphore.h>#include <fcntl.h>#include <sys/stat.h>#include <unistd.h>#include <stdlib.h>#include <stdio.h>#i...

2020-04-20 14:26:51 317

原创 消息队列

1.mq_open等相关系统函数使用#include <iostream>#include <algorithm>#include <cstring>#include <mqueue.h>#include <fcntl.h>#include <errno.h>#include <stdio.h>...

2020-04-16 15:05:09 136

原创 单例模式的四种线程安全的实现

1.懒汉经典模式,用互斥锁实现#include <pthread.h>#include <stdio.h>#include <iostream>class CSingletonLock{private: pthread_mutex_t m_mutex;public: CSingletonLock() { ...

2020-04-13 23:22:24 179

原创 多线程例程

1.子线程循环10次,主线程循环100次,接着子线程循环10次,如此循环50次,请写出代码#include <stdlib.h>#include <stdio.h>#include <pthread.h>#include <unistd.h>#define LOOPNUM 50#define MAINLOOPNUM 100#de...

2020-04-11 22:27:10 260

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除