Skip to content

Commit

Permalink
Merge pull request #2 from reyreaud-l/staging
Browse files Browse the repository at this point in the history
v2.0.0 release
  • Loading branch information
Loic Reyreaud committed Sep 21, 2018
2 parents e3b2ada + 19676df commit d420477
Show file tree
Hide file tree
Showing 21 changed files with 714 additions and 100 deletions.
184 changes: 182 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: none
sudo: false

git:
quiet: true

Expand All @@ -9,7 +9,187 @@ addons:
- cmake

script:
- if [ $TRAVIS_OS_NAME = "osx" ]; then brew update >/dev/null; fi
- if [ $TRAVIS_OS_NAME = "osx" ] && [ $BREW_SKIP = "false" ]; then brew install $BREW_INSTALL; fi
- if [ $TRAVIS_OS_NAME = "osx" ]; then brew upgrade cmake; fi
- mkdir build
- cd build
- cmake -DBUILD_TESTS=ON ..
- cmake -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON ..
- make check
- make examples

matrix:
fast_finish: true
include:
# Begin gcc
- os: linux
name: "Linux GCC 4.9"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.9
env:
- CC=gcc-4.9
- CXX=g++-4.9

- os: linux
name: "Linux GCC 5"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-5
env:
- CC=gcc-5
- CXX=g++-5

- os: linux
name: "Linux GCC 6"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-6
env:
- CC=gcc-6
- CXX=g++-6

- os: linux
name: "Linux GCC 7"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-7
env:
- CC=gcc-7
- CXX=g++-7
# End gcc

# Begin Clang
- os: linux
name: "Linux Clang 3.6"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.6
packages:
- clang-3.6
env:
- CC=clang-3.6
- CXX=clang++-3.6

- os: linux
name: "Linux Clang 3.7"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7
packages:
- clang-3.7
env:
- CC=clang-3.7
- CXX=clang++-3.7

- os: linux
name: "Linux Clang 3.8"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
packages:
- clang-3.8
env:
- CC=clang-3.8
- CXX=clang++-3.8

- os: linux
name: "Linux Clang 3.9"
addons:
apt:
sources:
- llvm-toolchain-trusty-3.9
packages:
- clang-3.9
env:
- CC=clang-3.9
- CXX=clang++-3.9

- os: linux
name: "Linux Clang 4.0"
addons:
apt:
sources:
- llvm-toolchain-trusty-4.0
packages:
- clang-4.0
env:
- CC=clang-4.0
- CXX=clang++-4.0

- os: linux
name: "Linux Clang 5.0"
addons:
apt:
sources:
- llvm-toolchain-trusty-5.0
packages:
- clang-5.0
env:
- CC=clang-5.0
- CXX=clang++-5.0
# End Clang

# Begin gcc OSX
- os: osx
name: "OSX GCC 5"
osx_image: xcode8
env:
- BREW_SKIP=false
- BREW_INSTALL=gcc@5
- CC=gcc-5
- CXX=g++-5

- os: osx
name: "OSX GCC 6"
osx_image: xcode8
env:
- BREW_SKIP=false
- BREW_INSTALL=gcc@6
- CC=gcc-6
- CXX=g++-6

- os: osx
name: "OSX GCC 7"
osx_image: xcode8
env:
- BREW_SKIP=false
- BREW_INSTALL=gcc@7
- CC=gcc-7
- CXX=g++-7
# End gcc OSX

# Begin clang OSX
- os: osx
name: "OSX Clang xcode8.3"
osx_image: xcode8.3
compiler: clang
env:
- BREW_SKIP=true

- os: osx
name: "OSX Clang xcode9.1"
osx_image: xcode9.1
compiler: clang
env:
- BREW_SKIP=true
# End clang OSX

13 changes: 10 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
cmake_minimum_required(VERSION 3.9)
set(LIB threadpool)
project(${LIB} LANGUAGES CXX VERSION 0.1)
project(${LIB} LANGUAGES CXX VERSION 2.0.0)

option(BUILD_TESTS "Build tests" OFF)
option(BUILD_EXAMPLES "Build examples" OFF)

set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

Expand All @@ -18,7 +19,7 @@ find_package(Threads REQUIRED)
# Compilation settings (for tests mainly)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic")
set(CMAKE_CXX_FLAGS_DEBUG "-g3 -O0 -fsanitize=address")
set(CMAKE_CXX_FLAGS_DEBUG "-g3 -O0")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")

add_subdirectory(include)
Expand All @@ -28,12 +29,18 @@ if ((BUILD_TESTS) OR (NOT CMAKE_BUILD_TYPE MATCHES "RELEASE"))
add_subdirectory(tests)
endif()

# Examples
if (BUILD_EXAMPLES)
add_subdirectory(doc/src/examples)
endif()

message(STATUS "-------------------------------")
message(STATUS "++ Setup: ")
message(STATUS "System: " ${CMAKE_SYSTEM})
message(STATUS "Build dir: " ${CMAKE_BINARY_DIR})
message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
message(STATUS "CXX: " ${CMAKE_CXX_COMPILER_ID})
message(STATUS "CXX: " ${CMAKE_CXX_COMPILER})
message(STATUS "CXX_ID: " ${CMAKE_CXX_COMPILER_ID})
message(STATUS "CXXFLAGS: " ${CMAKE_CXX_FLAGS} " " ${CMAKE_CXX_FLAGS_${BUILD_TYPE_SUFFIX}})
message(STATUS "Verbose: " ${CMAKE_VERBOSE_MAKEFILE})
message(STATUS "")
Expand Down
57 changes: 47 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# ThreadPool
# ThreadPool [![Build Status: master](https://travis-ci.org/reyreaud-l/threadpool.svg?branch=master)](https://travis-ci.org/reyreaud-l/threadpool) [![Doc Status: master](https://readthedocs.org/projects/threadpool/badge/?version=latest)](https://threadpool.readthedocs.io/en/latest/)
Modern C++ Thread Pool

# Available features
* Fixed size pool.
* Variable size pool.
* Fetch result of task run in the pool with `future`.
* Fetch results of tasks run in the pool with `future`.
* Fetch number of waiting/working workers.
* Hooks to monitor the threadpool (tasks/workers)

# Install
# Getting ThreadPool

## Install
To install, run the following commands to clone the repository and install
```bash
$ git clone git@github.com:reyreaud-l/threadpool.git
Expand All @@ -17,19 +20,53 @@ $ cd build
$ cmake ..
$ make install
```
## Uninstall
To uninstall, run the following command in build directory.
```bash
$ make uninstall
```

# Using ThreadPool

# Doc
## Documentation
Documentation is available on [ReadTheDoc](https://threadpool.readthedocs.io/en/latest/)

You will find multiples examples and a how to get started.

# Uninstall
To uninstall, run the following command in build directory.
```bash
$ make uninstall
```
## Compatibility
ThreadPool is tested on these platforms/compilers:
- Linux
- gcc
- 4.9
- 5
- 6
- 7
- clang
- 3.6
- 3.7
- 3.8
- 3.9
- 4.0
- 5.0
- OSX
- gcc
- 5
- 6
- 7
- clang xcode
- 8.3
- 9.1

# Contributing ThreadPool

## Contribute
To contribute, simply submit a PR to the repository or create and issue and I'll
take a look at it. Feel free to do whatever you want as well!

The unreleased modification are on the `staging` branch. The `master` branch
contains all the releases.

# Tests
## Tests
To tests, enable option `BUILD_TESTS` or build in `DEBUG` mode with either:
```bash
$ cmake -DBUILD_TESTS=ON ..
Expand Down
4 changes: 2 additions & 2 deletions doc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.

PROJECT_NAME = "Threadpool"
PROJECT_NAME = "ThreadPool"

# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = "0.1"
PROJECT_NUMBER = "1.0.0"

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
12 changes: 9 additions & 3 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = threadpool
SPHINXPROJ = ThreadPool
SOURCEDIR = .
BUILDDIR = _build
BUILDDIR = _build/

DOXYGEN = doxyxml/

# Put it first so that "make" without argument is like "make help".
help:
Expand All @@ -16,5 +18,9 @@ help:

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
clean:
rm -rf $(DOXYGEN)
rm -rf $(BUILDDIR)

%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

0 comments on commit d420477

Please sign in to comment.