How to register native thread