Seems like your ```pthread_create()``` does not receive the correct argument, which should be the a

Seems like your
pthread_create()
does not receive the correct argument, which should be the address of the
SensorData
struct, not the address of the
value
field within the struct.

This part of your code :

rc = pthread_create(&sensor_threads[t], NULL, sensor_task, (void *)&sensor_data[t].value);


Change it to pass the address of the
SensorData
struct instead:

rc = pthread_create(&sensor_threads[t], NULL, sensor_task, (void *)&sensor_data[t]);
Was this page helpful?