Activate the worker threads
| 76 | |
| 77 | /// Activate the worker threads |
| 78 | virtual int open(void* = 0) { |
| 79 | DBG_ENTRY("QueueTaskBase","open"); |
| 80 | |
| 81 | GuardType guard(this->lock_); |
| 82 | |
| 83 | // We can assume that we are in the proper state to handle this open() |
| 84 | // call as long as we haven't been open()'ed before. |
| 85 | if (this->opened_) { |
| 86 | ACE_ERROR_RETURN((LM_ERROR, |
| 87 | "(%P|%t) QueueTaskBase failed to open. " |
| 88 | "Task has previously been open()'ed.\n"), |
| 89 | -1); |
| 90 | } |
| 91 | |
| 92 | // Activate this task object with one worker thread. |
| 93 | if (this->activate(THR_NEW_LWP | THR_JOINABLE, 1) != 0) { |
| 94 | // Assumes that when activate returns non-zero return code that |
| 95 | // no threads were activated. |
| 96 | ACE_ERROR_RETURN((LM_ERROR, |
| 97 | "(%P|%t) QueueTaskBase failed to activate " |
| 98 | "the worker threads.\n"), |
| 99 | -1); |
| 100 | } |
| 101 | |
| 102 | // Now we have past the point where we can say we've been open()'ed before. |
| 103 | this->opened_ = true; |
| 104 | |
| 105 | return 0; |
| 106 | } |
| 107 | |
| 108 | /// The "mainline" executed by the worker thread. |
| 109 | virtual int svc() { |