I am writing a library for thread management using C++ for my app and as part of the same I am trying to write a template class that takes a FunctionPointer to be executed inside the run function. I am a Java developer and trying to visualize as follows:
class MyRunnable : public Runnable {
    public:
        MyRunnable(fp)
        {
            mFp = fp;
        }
    private:
    FunctionPointer mFp;
    // Will be called by the thread pool using a thread
    void run() 
    {
         mFp();
    }
}
class ThreadManager {
    public:
        void execute(MyRunnable runnable) {
            executeOnAThreadPool(runnable);
        }
}
Since I am not fluent with C++ syntax, I am finding hard to get the constructor defined to take a FunctionPointer as argument with variable number of arguments for the FunctionPointer. Something like:
MyRunnable(Fp fp, Args... args)
Can someone please help me defining the constructor for MyRunnable class above.
Thanks.
 
    