Important: Please read the Qt Code of Conduct -

What is the best idea for thread communication?

  • Hi,
    I am developing a linux program, the UI uses Qt, but core function uses c code (in another thread, of course). Platform is linux pc.
    Now I meet a problem. When some c structures are updated, I want to notify Qt about it.
    For example,
    struct Priv_data {
    int a;
    int b;
    } mydata;
    when mydata is updated, I want to notify Qt main thread about it(passing its address pointer) , so main thread can update the UI.
    Any good ideas?
    Thanks !

  • Lifetime Qt Champion

    Can you have Qt with the core C code
    threads so you can use signals and slots ?
    or must it be compiled with c compiler ?

  • Yes, c code must be compiled with gcc. They lies in a complex project with complex Makefile, I first compile c code to .o file, then compile qt code, final link is done by hand. I link all the .o files finally.

  • Lifetime Qt Champion


    How is the GUI part integrated in that project ?

    In any case, you have here a list of IPC mechanism available with Qt.

Log in to reply