[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] pthread_create



On Mon, 13 Dec 1999, Sune Fischer wrote:

> Hmm, hvordan giver man det tredie argument til
>  
> int  pthread_create(pthread_t  *  thread,
> pthread_attr_t * attr, void * (*start_routine)(void
> *), void * arg);
> 
> hvis nu min start_rutine har prototype:
> 
> char* myrutine(int,int);

Hmm, jeg tror du bliver nødt til at overføre en pointer-til-en-struktur:

struct foo {
	int a;
	int b;
};

foo *f = new eller malloc foo;
foo->a = 42;
foo->b = 50;
pthread_create ( .... foo)

char* myrutine (void *ptr) {
	f = (foo*) ptr;
	brug f->a ..
	brug f->b ..
	
	delete / free(foo);
}
	



-- 
==============================================================================
Erwin Andreasen   Herlev, Denmark <sslug@sslug>          UNIX System Programmer
<URL:http://www.andreasen.org>              <*>         (not speaking for) DDE
==============================================================================



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:07 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *