Skip to content

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

License

Notifications You must be signed in to change notification settings

billsioros/thread-pool-cpp98

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published