glib question - g_thread_create in a c++ program



Hi all!

in this code:
[cut]
gpointer chat_app::main_loop(gpointer data){
   ...code...
}

int chat_app::event_manager(){
    
    if ( ( this->id_thread=
        g_thread_create(this->main_loop, NULL, TRUE, NULL))==NULL  ){
           fprintf(stderr, "error\n")
           return(-1);
    }
    return(0);
}
[cut]

i've got this error:
chat_app.cpp:25: error: argument of type `void*(chat_app::)(void*)' does
not match `void*(*)(void*)'

the fast solution is to keep out "main_loop" from the class and give to
it the ptr of class instance:
        g_thread_create(main_loop, this, TRUE, NULL)

but in this way i cannot use the private methods...
is it possible to make a casting?
tnx all!


-- 
Dodiesis <dodiesis sgrunt net>
Sgrunt.net




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]