Skip to content
Advertisement

syscall or gettid system function from Cython

I need to call gettid from Cython. Accordingly to its man page, I should use the syscall function. I’m running Linux.

I can easily get the gettid function number:

JavaScript

But I cannot find how to import, or better cimport, syscall.

Any ideas?

Thanks.

Advertisement

Answer

You can look up in the cython’s github repository, how those includes are done best, for example: stdio.h.

Applying this leads to:

JavaScript

And now gettid() yields:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement