Perhaps you want: remove_element(&msg); // ? I think msg is bogus uninitialized pointer and pj_pool_release will surely crash. Bill On 8/27/2014 4:25 PM, Luis Domingues wrote: > Hello, > > I'm creating a automated call machine using PJSIP. For callbacks > treatment, I try to use another thread. But when I call a pjsip function > from this thread, my app crashes. > > The threaded function is this one: > > static void *destroy_players(void *args) > { > void *msg; > pj_thread_t *pj_thread; > pj_thread_desc desc; > pj_status_t status; > status = pj_thread_register("Destroy thread", desc, &pj_thread); > if(status == PJ_SUCCESS){ > printf("********************************Registration succeed\n"); > } else { > printf("********************************Registration failed\n"); > } > while(1) > { > sem_wait(&wait_destroy_player); > //Remove the message from a queue > remove_element(msg); > struct pjsua_player_eof_data *eof_data = (struct > pjsua_player_eof_data *)msg; > status = pjsua_call_hangup(eof_data->call_id, 0, NULL, NULL); > status = pjsua_player_destroy(eof_data->player_id); > > pj_pool_release(eof_data->pool); > } > } > > Did I forget something? Did I need to do somthing before creating the > thread? I'm creating the thread with the pthread API. > > Regards, > Luis Domingues > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip at lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org