Interfacing Python with a real-time stdout of a multithreaded-C-program

I’m trying to figure out the problem of retrieve the real-time streamed stdout from a multithreaded-C-program.

I found that Cython can retrieve a single return of a function but how can I handle the output of something like this:

void threaded_function(){
    int i = 0;
         i += 1;
         print("result: %i",i);

I tried with subprocess lib of python but it doesn’t work.

لینک منبع