| 68 | } |
| 69 | |
| 70 | void ThriftThread::RunRunnable( |
| 71 | const std::shared_ptr<atc::Runnable>& runnable, Promise<atc::Thread::id_t>* promise) { |
| 72 | promise->Set(get_current()); |
| 73 | // Passing runnable in to this method (rather than reading from this->runnable()) - |
| 74 | // preserved as a copy via std::bind - ensures that it will live as long as this |
| 75 | // method, otherwise the ThriftThread could be destroyed between the previous |
| 76 | // statement and this one (according to my reading of PosixThread). |
| 77 | runnable->run(); |
| 78 | } |
| 79 | |
| 80 | atc::Thread::id_t ThriftThreadFactory::getCurrentThreadId() const { |
| 81 | return atc::Thread::get_current(); |