For some code I am writing I am trying to get a threads but I keep getting an error. I am programming on linux in visual studio code.
This is the code:
void* start(void *s) {
int me = (int*)s;
//int me = pthread_self();
printf("Entered: %d\n", me);
Lock(me);
printf("TEST 1");
for (int i = 0; i<MAX; i++) ans++;
printf("TEST 2");
Unlock(me);
printf("TEST 3");
return NULL;
}
pthread_create(&thread1, NULL, start, (void*)0);
pthread_create(&thread2, NULL, start, (void*)1);
The pthread creates are inside of a main method. The error I'm getting:
error: invalid conversion from ‘int*’ to ‘int’ [-fpermissive] 49 | int me = (int*)s; | ^~~~~~~ | | | int*