| 93 | } |
| 94 | |
| 95 | int CpuEngine::createForAllThreads() { |
| 96 | int result = EPERM; |
| 97 | |
| 98 | ThreadList* thread_list = OS::listThreads(); |
| 99 | while (thread_list->hasNext()) { |
| 100 | int tid = thread_list->next(); |
| 101 | int err = createForThread(tid); |
| 102 | if (isResourceLimit(err)) { |
| 103 | result = err; |
| 104 | break; |
| 105 | } else if (result != 0) { |
| 106 | result = err; |
| 107 | } |
| 108 | } |
| 109 | delete thread_list; |
| 110 | |
| 111 | return result; |
| 112 | } |
| 113 | |
| 114 | void CpuEngine::signalHandler(int signo, siginfo_t* siginfo, void* ucontext) { |
| 115 | if (!_enabled) return; |