Skip to content

Instantly share code, notes, and snippets.

Avatar
🐢
on going

yoh yohhoy

🐢
on going
View GitHub Profile
@yohhoy
yohhoy / gist:1827903
Created Feb 14, 2012
Tiny Parallel Library
View gist:1827903
/**
* Tiny Parallel Library
*
* The library implements following parallel algorithms that its
* interface are compatible with Intel TBB and Microsoft PPL.
* - parallel_for_each(first,last,func)
* - parallel_for(first,last,func)
* - parallel_invoke(f1,f2,...) (up to 4 args)
*/
#ifndef TINYPL_HPP
@yohhoy
yohhoy / binsem.cpp
Last active Dec 8, 2016
binary semaphore for C++11
View binsem.cpp
#include <mutex>
#include <condition_variable>
// binary semaphore
class binsem {
public:
explicit binsem(int init_count = count_max)
: count_(init_count) {}
// P-operation / acquire
@yohhoy
yohhoy / threads.h
Last active Sep 18, 2020
C11 <threads.h> emulation library
View threads.h
/*
* C11 <threads.h> emulation library
*
* (C) Copyright yohhoy 2012.
* Distributed under the Boost Software License, Version 1.0.
* (See copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef EMULATED_THREADS_H_INCLUDED_
#define EMULATED_THREADS_H_INCLUDED_
@yohhoy
yohhoy / mock_tbb.h
Created Apr 2, 2012
Mockup implementation of TBB
View mock_tbb.h
/*
* Mockup implementation of Threading Building Blocks(TBB) library
*
* (C) Copyright yohhoy 2012.
* Distributed under the Boost Software License, Version 1.0.
* (See copy at http://www.boost.org/LICENSE_1_0.txt)
*
* Support:
* - Range concept (except `blocked_range3d')
* - Parallel algorithms (except `pipeline'/`parallel_pipeline')
@yohhoy
yohhoy / libfiber.hpp
Created Apr 6, 2012
fiber library(prototype)
View libfiber.hpp
/*
* libfiber.hpp
*
* (C) Copyright yohhoy 2012.
* Distributed under the Boost Software License, Version 1.0.
* (See copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef LIBFIBER_HPP_INCLUDED_
#define LIBFIBER_HPP_INCLUDED_
@yohhoy
yohhoy / example.cpp
Created Apr 9, 2012
example for "libfiber.hpp"
View example.cpp
/*
* example for "libfiber.hpp" - 2生産者-3消費者デモ
*/
#include <iostream>
#include <vector>
#include <boost/circular_buffer.hpp>
#include "libfiber.hpp"
// 上限付きFIFOキュー
@yohhoy
yohhoy / deferthread.cpp
Created Apr 19, 2012
deferred thread start
View deferthread.cpp
#include <iostream>
#define PROCESS (std::cout<<"do"<<std::endl)
//#define PROCESS (throw 42)
//--------------------------------
#ifdef TEST1
#include <boost/shared_ptr.hpp>
#include <boost/thread.hpp>
class X {
@yohhoy
yohhoy / once_function.cpp
Created Apr 27, 2012
once function(+binder)
View once_function.cpp
#include <tuple>
#include <memory>
#include <functional> // bad_function_call
#include <utility>
#include <type_traits>
namespace detail {
// index_tuple<size_t...>, make_indices<E,S>
@yohhoy
yohhoy / oledd.c
Created Jul 5, 2012
OLE Drag & Drop sample code
View oledd.c
/*
* OLE Drag and Drop module
*
* Copyright(c) 2001 yoh(yohhoy)
*/
#define STRICT
#define NONAMELESSUNION
#define COBJMACROS
#include <windows.h>
#include "oledd.h"
@yohhoy
yohhoy / tricky.bas
Created Jul 5, 2012
VisualBasic 6.0
View tricky.bas
Attribute VB_Name = "mdlMain"
Option Explicit
'
' tricky.bas
'
' Copyright(c) 2001 yoh(yohhoy)
'
' Win32API
Private Type WNDCLASS
You can’t perform that action at this time.