[PD-dev] How to pass indeterminate args to a thread

Martin Peach martin.peach at sympatico.ca
Sat Feb 28 04:08:10 CET 2009


Mathieu Bouchard wrote:
> On Fri, 27 Feb 2009, Martin Peach wrote:
> 
>> You called pthread_create() with &threadargs:
>>     ret = pthread_create( &thread1, NULL, mythread, &threadArgs);
>> when you probably should just use threadargs, since it's already a 
>> pointer.
>> Or else you need to dereference the handle:
>>     post("My symbol: %s",
>>         ((*(struct floatArgStruct**))threadArgs)->s->s_name);
> 
> No, it was supposed to be just threadArgs, but the type of threadArgs 
> changed while writing the code, as I made him change it from a global 
> variable to a malloc. In the end, it turns out it wasn't quite useful, 
> because there's only going to be one extra thread, after all.
> 

Too bad, you could have tested if the compiler could handle types 
changing while the code was being written.

Martin






More information about the Pd-dev mailing list