Add constructor for specifying number of dispatch threads.