billsioros / thread-pool-cpp98

A thread pool implemented in C++98 based on POSIX threads

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A thread pool implemented in C++98 based on POSIX threads

Example

#include <thread_pool.hpp>
#include <iostream>

static const char * messages[] =
{
    "Hello",
    "darkness",
    "my",
    "old",
    "friend"
};

void print(void * arg)
{
    char * message = static_cast<char *>(arg);

    std::cout << message << std::endl;
}

int main()
{
    thread_pool::create(10UL);

    for (std::size_t i = 0UL; i < (sizeof(messages) / sizeof(char *)); i++)
    {
        thread_pool::schedule(print, (void *)messages[i]);
    }

    thread_pool::block();

    thread_pool::destroy();

    return 0;
}

License

The project is licensed under the MIT License

About

A thread pool implemented in C++98 based on POSIX threads

License:MIT License


Languages

Language:C++ 90.1%Language:Makefile 9.9%