Subj : Re: returning arguments To : comp.programming.threads From : Joe Seigh Date : Wed Jun 29 2005 08:20 am Huub wrote: > I *thought* I understood it. Could you explain a bit more of the last > part of your comment please, including the casting to a pointer to the > structure? > Do you mean something like this: > > void *LeesSensoren(void *threadid) > { > ... > displaygegevens = dg; > ... > return (void*)&dg; > } > > void x() > { > ... > pthread_join(threads[t], &retp); > (*dg)*retp; > rookstatus = dg.rookstatus; > gasstatus = dg.gasstatus; > temperatuur = dg.temperatuur; > } > > Thank you for helping, > > Huub void *LeesSensoren(void *threadid) { struct displaygegevens *dg ... dg = (struct displaygegevens *)malloc(sizeof(struct displaygegevens)); ... return (void*)dg; } void x() { struct displaygegevens *dg pthreadcreate(&threads[t],NULL , &LeesSensoren, &threadid[t]); ... pthread_join(threads[t], (void **)&dg); rookstatus = dg->rookstatus; gasstatus = dg->gasstatus; temperatuur = dg->temperatuur; free(dg); } Something like that. -- Joe Seigh When you get lemons, you make lemonade. When you get hardware, you make software. .