Mark Slee | 9f0c651 | 2007-02-28 23:58:26 +0000 | [diff] [blame] | 1 | // Copyright (c) 2006- Facebook |
| 2 | // Distributed under the Thrift Software License |
| 3 | // |
| 4 | // See accompanying file LICENSE or visit the Thrift site at: |
| 5 | // http://developers.facebook.com/thrift/ |
| 6 | |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 7 | #include "PosixThreadFactory.h" |
Marc Slemko | 3a3b53b | 2007-05-22 23:59:54 +0000 | [diff] [blame] | 8 | #include "Exception.h" |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 9 | |
| 10 | #include <assert.h> |
| 11 | #include <pthread.h> |
| 12 | |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 13 | #include <iostream> |
| 14 | |
| 15 | #include <boost/weak_ptr.hpp> |
| 16 | |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 17 | namespace facebook { namespace thrift { namespace concurrency { |
| 18 | |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 19 | using namespace boost; |
| 20 | |
Mark Slee | f5f2be4 | 2006-09-05 21:05:31 +0000 | [diff] [blame] | 21 | /** |
Marc Slemko | 3a3b53b | 2007-05-22 23:59:54 +0000 | [diff] [blame] | 22 | * The POSIX thread class. |
Mark Slee | f5f2be4 | 2006-09-05 21:05:31 +0000 | [diff] [blame] | 23 | * |
| 24 | * @author marc |
| 25 | * @version $Id:$ |
| 26 | */ |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 27 | class PthreadThread: public Thread { |
Mark Slee | f5f2be4 | 2006-09-05 21:05:31 +0000 | [diff] [blame] | 28 | public: |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 29 | |
Mark Slee | f5f2be4 | 2006-09-05 21:05:31 +0000 | [diff] [blame] | 30 | enum STATE { |
| 31 | uninitialized, |
| 32 | starting, |
| 33 | started, |
| 34 | stopping, |
| 35 | stopped |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 36 | }; |
| 37 | |
| 38 | static const int MB = 1024 * 1024; |
| 39 | |
Marc Slemko | 8a40a76 | 2006-07-19 17:46:50 +0000 | [diff] [blame] | 40 | static void* threadMain(void* arg); |
| 41 | |
Mark Slee | f5f2be4 | 2006-09-05 21:05:31 +0000 | [diff] [blame] | 42 | private: |
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 43 | pthread_t pthread_; |
| 44 | STATE state_; |
| 45 | int policy_; |
| 46 | int priority_; |
| 47 | int stackSize_; |
| 48 | weak_ptr<PthreadThread> self_; |
Marc Slemko | 67606e5 | 2007-06-04 21:01:19 +0000 | [diff] [blame^] | 49 | bool detached_; |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 50 | |
Mark Slee | f5f2be4 | 2006-09-05 21:05:31 +0000 | [diff] [blame] | 51 | public: |
Marc Slemko | 3a3b53b | 2007-05-22 23:59:54 +0000 | [diff] [blame] | 52 | |
Marc Slemko | 67606e5 | 2007-06-04 21:01:19 +0000 | [diff] [blame^] | 53 | PthreadThread(int policy, int priority, int stackSize, bool detached, shared_ptr<Runnable> runnable) : |
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 54 | pthread_(0), |
Marc Slemko | 3a3b53b | 2007-05-22 23:59:54 +0000 | [diff] [blame] | 55 | state_(uninitialized), |
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 56 | policy_(policy), |
| 57 | priority_(priority), |
Marc Slemko | 67606e5 | 2007-06-04 21:01:19 +0000 | [diff] [blame^] | 58 | stackSize_(stackSize), |
| 59 | detached_(detached) { |
Marc Slemko | fe5ba12e | 2006-07-20 21:16:27 +0000 | [diff] [blame] | 60 | |
| 61 | this->Thread::runnable(runnable); |
| 62 | } |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 63 | |
Marc Slemko | 67606e5 | 2007-06-04 21:01:19 +0000 | [diff] [blame^] | 64 | ~PthreadThread() { |
| 65 | /* Nothing references this thread, if is is not detached, do a join |
| 66 | now, otherwise the thread-id and, possibly, other resources will |
| 67 | be leaked. */ |
| 68 | if(!detached_) { |
| 69 | try { |
| 70 | join(); |
| 71 | } catch(...) { |
| 72 | // We're really hosed. |
| 73 | } |
| 74 | } |
| 75 | } |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 76 | |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 77 | void start() { |
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 78 | if (state_ != uninitialized) { |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 79 | return; |
| 80 | } |
| 81 | |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 82 | pthread_attr_t thread_attr; |
Mark Slee | 2782d6d | 2007-05-23 04:55:30 +0000 | [diff] [blame] | 83 | if (pthread_attr_init(&thread_attr) != 0) { |
Marc Slemko | 3a3b53b | 2007-05-22 23:59:54 +0000 | [diff] [blame] | 84 | throw SystemResourceException("pthread_attr_init failed"); |
| 85 | } |
Aditya Agarwal | 9dc5740 | 2007-03-31 17:45:12 +0000 | [diff] [blame] | 86 | |
Marc Slemko | 67606e5 | 2007-06-04 21:01:19 +0000 | [diff] [blame^] | 87 | if(pthread_attr_setdetachstate(&thread_attr, |
| 88 | detached_ ? |
| 89 | PTHREAD_CREATE_DETACHED : |
| 90 | PTHREAD_CREATE_JOINABLE) != 0) { |
| 91 | throw SystemResourceException("pthread_attr_setdetachstate failed"); |
Marc Slemko | 3a3b53b | 2007-05-22 23:59:54 +0000 | [diff] [blame] | 92 | } |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 93 | |
| 94 | // Set thread stack size |
Mark Slee | 2782d6d | 2007-05-23 04:55:30 +0000 | [diff] [blame] | 95 | if (pthread_attr_setstacksize(&thread_attr, MB * stackSize_) != 0) { |
| 96 | throw SystemResourceException("pthread_attr_setstacksize failed"); |
Marc Slemko | 3a3b53b | 2007-05-22 23:59:54 +0000 | [diff] [blame] | 97 | } |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 98 | |
| 99 | // Set thread policy |
Mark Slee | 2782d6d | 2007-05-23 04:55:30 +0000 | [diff] [blame] | 100 | if (pthread_attr_setschedpolicy(&thread_attr, policy_) != 0) { |
| 101 | throw SystemResourceException("pthread_attr_setschedpolicy failed"); |
Marc Slemko | 3a3b53b | 2007-05-22 23:59:54 +0000 | [diff] [blame] | 102 | } |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 103 | |
| 104 | struct sched_param sched_param; |
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 105 | sched_param.sched_priority = priority_; |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 106 | |
| 107 | // Set thread priority |
Mark Slee | 2782d6d | 2007-05-23 04:55:30 +0000 | [diff] [blame] | 108 | if (pthread_attr_setschedparam(&thread_attr, &sched_param) != 0) { |
| 109 | throw SystemResourceException("pthread_attr_setschedparam failed"); |
Marc Slemko | 3a3b53b | 2007-05-22 23:59:54 +0000 | [diff] [blame] | 110 | } |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 111 | |
Mark Slee | f5f2be4 | 2006-09-05 21:05:31 +0000 | [diff] [blame] | 112 | // Create reference |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 113 | shared_ptr<PthreadThread>* selfRef = new shared_ptr<PthreadThread>(); |
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 114 | *selfRef = self_.lock(); |
Marc Slemko | 3a3b53b | 2007-05-22 23:59:54 +0000 | [diff] [blame] | 115 | |
Marc Slemko | 67606e5 | 2007-06-04 21:01:19 +0000 | [diff] [blame^] | 116 | state_ = starting; |
| 117 | |
Mark Slee | 2782d6d | 2007-05-23 04:55:30 +0000 | [diff] [blame] | 118 | if (pthread_create(&pthread_, &thread_attr, threadMain, (void*)selfRef) != 0) { |
| 119 | throw SystemResourceException("pthread_create failed"); |
Marc Slemko | 3a3b53b | 2007-05-22 23:59:54 +0000 | [diff] [blame] | 120 | } |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | void join() { |
Marc Slemko | 67606e5 | 2007-06-04 21:01:19 +0000 | [diff] [blame^] | 124 | if (!detached_ && state_ != uninitialized) { |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 125 | void* ignore; |
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 126 | pthread_join(pthread_, &ignore); |
Marc Slemko | 67606e5 | 2007-06-04 21:01:19 +0000 | [diff] [blame^] | 127 | detached_ = true; |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 128 | } |
| 129 | } |
| 130 | |
Marc Slemko | 3a3b53b | 2007-05-22 23:59:54 +0000 | [diff] [blame] | 131 | id_t id() { |
Marc Slemko | 67606e5 | 2007-06-04 21:01:19 +0000 | [diff] [blame^] | 132 | return static_cast<id_t>(pthread_); |
Marc Slemko | 3a3b53b | 2007-05-22 23:59:54 +0000 | [diff] [blame] | 133 | } |
| 134 | |
Mark Slee | f5f2be4 | 2006-09-05 21:05:31 +0000 | [diff] [blame] | 135 | shared_ptr<Runnable> runnable() const { return Thread::runnable(); } |
Marc Slemko | fe5ba12e | 2006-07-20 21:16:27 +0000 | [diff] [blame] | 136 | |
Mark Slee | f5f2be4 | 2006-09-05 21:05:31 +0000 | [diff] [blame] | 137 | void runnable(shared_ptr<Runnable> value) { Thread::runnable(value); } |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 138 | |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 139 | void weakRef(shared_ptr<PthreadThread> self) { |
Aditya Agarwal | 3f234da | 2007-04-01 01:19:57 +0000 | [diff] [blame] | 140 | assert(self.get() == this); |
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 141 | self_ = weak_ptr<PthreadThread>(self); |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 142 | } |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 143 | }; |
| 144 | |
Marc Slemko | 8a40a76 | 2006-07-19 17:46:50 +0000 | [diff] [blame] | 145 | void* PthreadThread::threadMain(void* arg) { |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 146 | shared_ptr<PthreadThread> thread = *(shared_ptr<PthreadThread>*)arg; |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 147 | delete reinterpret_cast<shared_ptr<PthreadThread>*>(arg); |
| 148 | |
Mark Slee | f5f2be4 | 2006-09-05 21:05:31 +0000 | [diff] [blame] | 149 | if (thread == NULL) { |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 150 | return (void*)0; |
| 151 | } |
| 152 | |
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 153 | if (thread->state_ != starting) { |
Marc Slemko | 8a40a76 | 2006-07-19 17:46:50 +0000 | [diff] [blame] | 154 | return (void*)0; |
| 155 | } |
| 156 | |
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 157 | thread->state_ = starting; |
Marc Slemko | fe5ba12e | 2006-07-20 21:16:27 +0000 | [diff] [blame] | 158 | thread->runnable()->run(); |
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 159 | if (thread->state_ != stopping && thread->state_ != stopped) { |
| 160 | thread->state_ = stopping; |
Marc Slemko | 8a40a76 | 2006-07-19 17:46:50 +0000 | [diff] [blame] | 161 | } |
Marc Slemko | 3a3b53b | 2007-05-22 23:59:54 +0000 | [diff] [blame] | 162 | |
Marc Slemko | 8a40a76 | 2006-07-19 17:46:50 +0000 | [diff] [blame] | 163 | return (void*)0; |
| 164 | } |
| 165 | |
Mark Slee | f5f2be4 | 2006-09-05 21:05:31 +0000 | [diff] [blame] | 166 | /** |
| 167 | * POSIX Thread factory implementation |
| 168 | */ |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 169 | class PosixThreadFactory::Impl { |
| 170 | |
Mark Slee | f5f2be4 | 2006-09-05 21:05:31 +0000 | [diff] [blame] | 171 | private: |
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 172 | POLICY policy_; |
| 173 | PRIORITY priority_; |
| 174 | int stackSize_; |
| 175 | bool detached_; |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 176 | |
Mark Slee | f5f2be4 | 2006-09-05 21:05:31 +0000 | [diff] [blame] | 177 | /** |
| 178 | * Converts generic posix thread schedule policy enums into pthread |
| 179 | * API values. |
| 180 | */ |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 181 | static int toPthreadPolicy(POLICY policy) { |
Mark Slee | b9ff32a | 2006-11-16 01:00:24 +0000 | [diff] [blame] | 182 | switch (policy) { |
| 183 | case OTHER: |
| 184 | return SCHED_OTHER; |
| 185 | case FIFO: |
| 186 | return SCHED_FIFO; |
| 187 | case ROUND_ROBIN: |
| 188 | return SCHED_RR; |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 189 | } |
Mark Slee | b9ff32a | 2006-11-16 01:00:24 +0000 | [diff] [blame] | 190 | return SCHED_OTHER; |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 191 | } |
| 192 | |
Mark Slee | f5f2be4 | 2006-09-05 21:05:31 +0000 | [diff] [blame] | 193 | /** |
| 194 | * Converts relative thread priorities to absolute value based on posix |
| 195 | * thread scheduler policy |
| 196 | * |
| 197 | * The idea is simply to divide up the priority range for the given policy |
| 198 | * into the correpsonding relative priority level (lowest..highest) and |
| 199 | * then pro-rate accordingly. |
| 200 | */ |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 201 | static int toPthreadPriority(POLICY policy, PRIORITY priority) { |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 202 | int pthread_policy = toPthreadPolicy(policy); |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 203 | int min_priority = sched_get_priority_min(pthread_policy); |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 204 | int max_priority = sched_get_priority_max(pthread_policy); |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 205 | int quanta = (HIGHEST - LOWEST) + 1; |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 206 | float stepsperquanta = (max_priority - min_priority) / quanta; |
| 207 | |
Mark Slee | 2905078 | 2006-09-29 00:12:30 +0000 | [diff] [blame] | 208 | if (priority <= HIGHEST) { |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 209 | return (int)(min_priority + stepsperquanta * priority); |
| 210 | } else { |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 211 | // should never get here for priority increments. |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 212 | assert(false); |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 213 | return (int)(min_priority + stepsperquanta * NORMAL); |
| 214 | } |
| 215 | } |
| 216 | |
Mark Slee | f5f2be4 | 2006-09-05 21:05:31 +0000 | [diff] [blame] | 217 | public: |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 218 | |
Marc Slemko | 3a3b53b | 2007-05-22 23:59:54 +0000 | [diff] [blame] | 219 | Impl(POLICY policy, PRIORITY priority, int stackSize, bool detached) : |
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 220 | policy_(policy), |
| 221 | priority_(priority), |
| 222 | stackSize_(stackSize), |
| 223 | detached_(detached) {} |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 224 | |
Mark Slee | f5f2be4 | 2006-09-05 21:05:31 +0000 | [diff] [blame] | 225 | /** |
Marc Slemko | 3a3b53b | 2007-05-22 23:59:54 +0000 | [diff] [blame] | 226 | * Creates a new POSIX thread to run the runnable object |
Mark Slee | f5f2be4 | 2006-09-05 21:05:31 +0000 | [diff] [blame] | 227 | * |
| 228 | * @param runnable A runnable object |
| 229 | */ |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 230 | shared_ptr<Thread> newThread(shared_ptr<Runnable> runnable) const { |
Marc Slemko | 67606e5 | 2007-06-04 21:01:19 +0000 | [diff] [blame^] | 231 | shared_ptr<PthreadThread> result = shared_ptr<PthreadThread>(new PthreadThread(toPthreadPolicy(policy_), toPthreadPriority(policy_, priority_), stackSize_, detached_, runnable)); |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 232 | result->weakRef(result); |
| 233 | runnable->thread(result); |
| 234 | return result; |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 235 | } |
| 236 | |
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 237 | int stackSize() const { return stackSize_; } |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 238 | |
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 239 | void stackSize(int value) { stackSize_ = value; } |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 240 | |
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 241 | PRIORITY priority() const { return priority_; } |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 242 | |
Marc Slemko | 67606e5 | 2007-06-04 21:01:19 +0000 | [diff] [blame^] | 243 | Thread::id_t currentThreadId() const {return static_cast<id_t>(pthread_self());} |
Marc Slemko | 3a3b53b | 2007-05-22 23:59:54 +0000 | [diff] [blame] | 244 | |
Mark Slee | f5f2be4 | 2006-09-05 21:05:31 +0000 | [diff] [blame] | 245 | /** |
| 246 | * Sets priority. |
| 247 | * |
| 248 | * XXX |
| 249 | * Need to handle incremental priorities properly. |
| 250 | */ |
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 251 | void priority(PRIORITY value) { priority_ = value; } |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 252 | }; |
| 253 | |
Marc Slemko | 3a3b53b | 2007-05-22 23:59:54 +0000 | [diff] [blame] | 254 | PosixThreadFactory::PosixThreadFactory(POLICY policy, PRIORITY priority, int stackSize, bool detached) : |
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 255 | impl_(new PosixThreadFactory::Impl(policy, priority, stackSize, detached)) {} |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 256 | |
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 257 | shared_ptr<Thread> PosixThreadFactory::newThread(shared_ptr<Runnable> runnable) const { return impl_->newThread(runnable); } |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 258 | |
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 259 | int PosixThreadFactory::stackSize() const { return impl_->stackSize(); } |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 260 | |
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 261 | void PosixThreadFactory::stackSize(int value) { impl_->stackSize(value); } |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 262 | |
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 263 | PosixThreadFactory::PRIORITY PosixThreadFactory::priority() const { return impl_->priority(); } |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 264 | |
Mark Slee | 2f6404d | 2006-10-10 01:37:40 +0000 | [diff] [blame] | 265 | void PosixThreadFactory::priority(PosixThreadFactory::PRIORITY value) { impl_->priority(value); } |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 266 | |
Mark Slee | 2782d6d | 2007-05-23 04:55:30 +0000 | [diff] [blame] | 267 | Thread::id_t PosixThreadFactory::currentThreadId() const { return impl_->currentThreadId(); } |
Marc Slemko | 3a3b53b | 2007-05-22 23:59:54 +0000 | [diff] [blame] | 268 | |
Marc Slemko | 6694987 | 2006-07-15 01:52:39 +0000 | [diff] [blame] | 269 | }}} // facebook::thrift::concurrency |