title: how to get thread ID as integer on BSD in C/C++?
body: <p>Does anyone know to get the current thread ID as an integer on BSD?</p>
  
  <p>i found this</p>
  
  <pre><code>#ifdef RTHREADS
    299     STD     { pid_t sys_getthrid(void); }
    300     STD     { int sys_thrsleep(void *ident, int timeout, void *lock); }
    301     STD     { int sys_thrwakeup(void *ident, int n); }
    302     STD     { int sys_threxit(int rval); }
    303     STD     { int sys_thrsigdivert(sigset_t sigmask); }
  #else
    299     UNIMPL
    300     UNIMPL
    301     UNIMPL
    302     UNIMPL
    303     UNIMPL
  #endif
  </code></pre>
  
  <p>and tried (long)syscall(229) but does not work (it crashes). On Linux i can get thread ID with system call (long) syscall(224) which gives me an integer (usually 4 digits). Anyone can help?! Thank you.</p>