I have had several problems with pthread.h. The latest is a definition conflict.
The code is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
/* Main.c for PC side of control fed to
* AVR by UART/ RS232
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <pthread.h>
void *control_updater (unsigned char rs232_control[10][10]);
int main(int argc, char **argv)
{ // <------ This is line 20
control_init();
pthread_t control_thread;
int iret, i, x;
iret = pthread_create(&control_thread, NULL, control_updater, rs232_control);
while (1)
{
printf("Control: sidewaves\n"); // sidewaves
sidewaves(2000,100);
printf("Control: ripples\n"); // ripples
ripples(2000,100);
printf("Control: spinwave\n"); // spinwave
spin(2000,100);
printf("Control: sinewaves\n"); // Sinelwave
sinelines(2000,100);
printf("Control spherical\n"); // Spherical
spherical1500,100);
printf("Control: Explosive"); // Explosive
fireworks(7,50,1200);
}
}
void *control_updater (unsigned char rs232_control[10][10])
{
unsigned char send_control[10][10];
while (1)
{
memcpy(send_control, rs232_control, 100);
control_push(send_control);
}
}
|
There are numerous other files.
The compiler error is:
--------------------------------------------------------------------------
/home/bruce/Desktop/main.c|26|warning: passing argument 3 of ‘pthread_create’ from incompatible pointer type [enabled by default]|\
/usr/include/pthread.h|225|note: expected ‘void * (*)(void *)’ but argument is of type ‘void * (*)(unsigned char (*)[8])’|
||=== Build finished: 1 errors, 8 warnings ===|
---------------------------------------------------------------------------
The definition in conflict in pthread.h is:
---------------------------------------------------------------------------
/* Create a new thread, starting with execution of START-ROUTINE
getting passed ARG. Creation attributed come from ATTR. The new
handle is stored in *NEWTHREAD. */
extern int pthread_create (pthread_t *__restrict __newthread,
__const pthread_attr_t *__restrict __attr,
void *(*__start_routine) (void *),// <--problem rea
void *__restrict __arg) __THROWNL __nonnull ((1, 3));
--------------------------------------------------------------------------------
It seems to say that the arguement " void*(*_start_routine) (void*) " refers to
my initiation function
void *control_updater (unsigned char rs232_control[10][10]);
The function definition in pthread.h seems to match the start_routine I've described, but the error message seems to find fault with the arguement for the function.
Can anyone find my oversight?