Gerard-Meier

How to use thread pool

May 26th, 2012
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. ThreadPool* pool = createPool(4); // Intentionally ignoring the CORE * 2 + 1 rule.
  2.  
  3.     for(i = 0; i < 2; ++i) {
  4.         Task task;
  5.         task.deadline = 3; // in seconds.
  6.         task.runnable = &echoTest;
  7.         addTask(pool, &task);
  8.     }
  9.  
  10.     for(i = 0; i < 10; ++i) {
  11.         Task task;
  12.         task.deadline = DONTCARE;
  13.         task.runnable = &starve;
  14.         addTask(pool, &task);
  15.     }
Advertisement
Add Comment
Please, Sign In to add comment