remove ffi related files
refactor thread and cdef initialization