Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1109555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:15:14+00:00 2026-05-17T02:15:14+00:00

I’m trying to create a threadpool with the boost threadpool library, but on defining

  • 0

I’m trying to create a threadpool with the boost threadpool library, but on defining it I keep getting lots of error about template params being wrong.

I’m probably doing something fundamentally wrong, but I’m not seeing it?

//Threadpool
typedef boost::threadpool::thread_pool<
    boost::threadpool::task_func,
    boost::threadpool::fifo_scheduler<tsk>,
    boost::threadpool::static_size<boost::threadpool::fifo_pool>,
    boost::threadpool::resize_controller<boost::threadpool::fifo_pool>,
    boost::threadpool::wait_for_active_tasks<boost::threadpool::fifo_pool>
>  pool;

ERRORS:

------ Build started: Project: Trial, Configuration: Debug Win32 ------

Compiling...
Trial.cpp
error C2923: 'boost::threadpool::fifo_scheduler' : 'tsk' is invalid as template argument '#1', type expected
       see declaration of 'tsk'
 error C3200: 'boost::threadpool::fifo_pool' : invalid template argument for template parameter 'SizePolicy', expected a class template
error C3200: 'boost::threadpool::resize_controller<Pool>' : invalid template argument for template parameter 'SizePolicyController', expected a class template
        with
        [
            Pool=boost::threadpool::fifo_pool
        ]
error C3200: 'boost::threadpool::wait_for_active_tasks<Pool>' : invalid template argument for template parameter 'ShutdownPolicy', expected a class template
        with
        [
            Pool=boost::threadpool::fifo_pool
        ]
error C3200: 'boost::threadpool::fifo_pool' : invalid template argument for template parameter 'SizePolicy', expected a class template
        see reference to class template instantiation 'boost::threadpool::thread_pool<Task,SchedulingPolicy,SizePolicy,SizePolicyController,ShutdownPolicy>' being compiled
        with
        [
            Task=boost::threadpool::task_func,
            SchedulingPolicy=boost::threadpool::fifo_scheduler,
            SizePolicy=boost::threadpool::fifo_pool,
            SizePolicyController=boost::threadpool::resize_controller<boost::threadpool::fifo_pool>,
            ShutdownPolicy=boost::threadpool::wait_for_active_tasks<boost::threadpool::fifo_pool>
        ]
c:\Program Files\boost\boost_1_44\boost\threadpool\pool.hpp(79) : error C3200: 'boost::threadpool::resize_controller<Pool>' : invalid template argument for template parameter 'SizePolicyController', expected a class template
        with
        [
            Pool=boost::threadpool::fifo_pool
        ]
c:\Program Files\boost\boost_1_44\boost\threadpool\pool.hpp(79) : error C3200: 'boost::threadpool::wait_for_active_tasks<Pool>' : invalid template argument for template parameter 'ShutdownPolicy', expected a class template
        with
        [
            Pool=boost::threadpool::fifo_pool
        ]
c:\Program Files\boost\boost_1_44\boost\threadpool\pool.hpp(91) : error C2059: syntax error : '<'
c:\Program Files\boost\boost_1_44\boost\threadpool\pool.hpp(91) : error C2238: unexpected token(s) preceding ';'
c:\Program Files\boost\boost_1_44\boost\threadpool\pool.hpp(92) : error C2059: syntax error : '<'
c:\Program Files\boost\boost_1_44\boost\threadpool\pool.hpp(92) : error C2238: unexpected token(s) preceding ';'
c:\Program Files\boost\boost_1_44\boost\threadpool\pool.hpp(111) : error C2146: syntax error : missing ';' before identifier 'size_controller'
c:\Program Files\boost\boost_1_44\boost\threadpool\pool.hpp(111) : error C2501: 'boost::threadpool::thread_pool<Task,SchedulingPolicy,SizePolicy,SizePolicyController,ShutdownPolicy>::size_controller_type' : missing storage-class or type specifiers
        with
        [
            Task=boost::threadpool::task_func,
            SchedulingPolicy=boost::threadpool::fifo_scheduler,
            SizePolicy=boost::threadpool::fifo_pool,
            SizePolicyController=boost::threadpool::resize_controller<boost::threadpool::fifo_pool>,
            ShutdownPolicy=boost::threadpool::wait_for_active_tasks<boost::threadpool::fifo_pool>
        ]
c:\Program Files\boost\boost_1_44\boost\threadpool\pool.hpp(112) : warning C4183: 'size_controller': missing return type; assumed to be a member function returning 'int'

---------------------- Done ----------------------

    Build: 0 succeeded, 1 failed, 0 skipped
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:15:15+00:00Added an answer on May 17, 2026 at 2:15 am

    According to your comment, tsk is a variable. You can’t pass runtime expressions (such as a variable) as template parameters. Templates are entirely compile-time.

    For this specific problem, you just need to do this:

    typedef boost::threadpool::thread_pool<> pool;
    void taskfunc();
    
    // later on...
    pool my_pool;
    my_pool.schedule(&taskfunc);
    

    boost::threadpool::task_func is just a boost::function0<void> — any 0-arg void function pointer can convert to that type.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.