C++ベースのLightweightなHTTPサーバー
| Revision | 426e9a6532f48c2c213eb03617a54d14e34e0faa (tree) |
|---|---|
| Time | 2012-12-16 23:39:14 |
| Author | Michio Hirai <smg_ykz@user...> |
| Commiter | Michio Hirai |
[BugFix] Fix the problem that isMainThread() inline function is properly compiled in Linux environment.
| @@ -4,22 +4,23 @@ | ||
| 4 | 4 | |
| 5 | 5 | #if __linux__ |
| 6 | 6 | #include <sys/types.h> |
| 7 | -#include <linux/unistd.h> | |
| 7 | +#include <sys/syscall.h> | |
| 8 | +#include <unistd.h> | |
| 8 | 9 | |
| 9 | 10 | namespace cm { |
| 10 | 11 | |
| 11 | 12 | inline bool isMainThread() |
| 12 | 13 | { |
| 13 | - return gettid() == getpid(); | |
| 14 | + return syscall(SYS_gettid) == getpid(); | |
| 14 | 15 | } |
| 15 | 16 | |
| 16 | 17 | } // namespace |
| 17 | 18 | |
| 18 | 19 | #elif ((__FreeBSD__) || (__MACH__ && __APPLE__)) |
| 19 | -namespace cm { | |
| 20 | - | |
| 21 | 20 | #include <pthread.h> |
| 22 | 21 | |
| 22 | +namespace cm { | |
| 23 | + | |
| 23 | 24 | inline bool isMainThread() |
| 24 | 25 | { |
| 25 | 26 | return pthread_main_np(); |