View threadpool.hpp
#ifndef THREAD_POOL | |
#define THREAD_POOL | |
#include <pthread.h> | |
#include <stdlib.h> // malloc | |
#include <unistd.h> // sleep,usleep | |
#include "queue.hpp" | |
#include <assert.h> | |
#include <sys/resource.h> // rlimit | |
namespace{ |
View lockfree_stack.cpp
template<typename obj> | |
class lf_stack{ | |
private: | |
class node{ | |
public: | |
obj data; | |
node* next; | |
node(const obj& d):data(d),next(NULL){ } | |
}; | |
volatile node *head; |
View deviding_tag.cpp
#include <stdlib.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <string.h> | |
#include <assert.h> | |
#include <unistd.h> | |
#include <time.h> | |
class deviding_tag { | |
private: |
View lockfree::queue.hpp
#ifndef LOCKFREE_QUEUE | |
#define LOCKFREE_QUEUE | |
#include "atomics.h" | |
#include <unistd.h> // usleep | |
#include <stdlib.h> // rand | |
namespace lockfree{ | |
template<typename T> |
View atomics.h
#ifndef ATOMICS | |
#define ATOMICS | |
#if __x86_64__ || _WIN64 | |
#define _64BIT | |
#define _ptr long long | |
#else | |
#define _32BIT | |
#define _ptr int |
View kvs_client_sample.py
#!/usr/bin/python | |
import msgpack | |
import socket,struct,sys,time | |
SET=0 | |
GET=1 | |
DELETE=2 | |
FOUND=3 | |
DONE=4 | |
NONE=5 |
View msgpack_client.cpp
#include <stdint.h> | |
#include <msgpack.hpp> | |
#include <mp/wavy.h> | |
#include <fcntl.h> | |
#include <errno.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <arpa/inet.h> |
View msgpack_server.cpp
#include <stdint.h> | |
#include <stdlib.h> | |
#include <msgpack.hpp> | |
#include <mp/wavy.h> | |
#include <fcntl.h> | |
#include <errno.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <arpa/inet.h> | |
#include <netinet/in.h> |
View tcp_wrapper.cpp
static int OK = 1; | |
int create_tcpsocket(void){ | |
int fd = socket(AF_INET,SOCK_STREAM, 0); | |
if(fd < 0){ | |
perror("scocket"); | |
} | |
return fd; | |
} |
View tokyo cabinet hashmap in C++
#ifndef TCPP_HPP_ | |
#define TCPP_HPP_ | |
#include <tcutil.h> | |
#include <tchdb.h> | |
#include <stdlib.h> | |
#include <stdbool.h> | |
#include <stdint.h> |
OlderNewer