| 1881 | } |
| 1882 | |
| 1883 | void* thread_local_data() { |
| 1884 | const Server::ThreadLocalOptions* tl_options = |
| 1885 | static_cast<const Server::ThreadLocalOptions*>(bthread_get_assigned_data()); |
| 1886 | if (tl_options == NULL) { // not in server threads. |
| 1887 | return NULL; |
| 1888 | } |
| 1889 | if (BAIDU_UNLIKELY(tl_options->thread_local_data_factory == NULL)) { |
| 1890 | CHECK(false) << "The protocol impl. may not set tls correctly"; |
| 1891 | return NULL; |
| 1892 | } |
| 1893 | void* data = bthread_getspecific(tl_options->tls_key); |
| 1894 | if (data == NULL) { |
| 1895 | data = tl_options->thread_local_data_factory->CreateData(); |
| 1896 | if (data != NULL) { |
| 1897 | CHECK_EQ(0, bthread_setspecific(tl_options->tls_key, data)); |
| 1898 | } |
| 1899 | } |
| 1900 | return data; |
| 1901 | } |
| 1902 | |
| 1903 | inline void tabs_li(std::ostream& os, const char* link, |
| 1904 | const char* tab_name, const char* current_tab_name) { |
no test coverage detected