hey thanks for your reply.
the program has three threads.
One to populate a link list of structs with data - its pulling in 802.11 packets and stripping some data from them.
The second thread calculates some metrics from the data in these linked lists roughly every 5 seconds.
Then the third thread runs the function seen below to print the UI - and yeah the problem is like I said above.
Code:
void *printGUI()
{
while(1)
{
//printf("\033[2J");
//printf("\033[0;0f");
system("clear");
printf("ACCESS POINTS\n");
printf("=============\n\n");
struct accessPoint *ap;
//pthread_mutex_lock( &G.mutex1 );
list_for_each(&G.apList.accessPoints, ap, apList)
{
printf("%02x:%02x\n", ap->mac[4],ap->mac[5]);
printf("Pwr:\t\tAverage: %d\tVariance: %d\tStanDev: %lf\n",ap->avgpower, ap->varpower, ap->sdpower);
}
//pthread_mutex_unlock( &G.mutex1 );
printf("USERS\n");
printf("=====\n\n");
struct station *sta;
//pthread_mutex_lock( &G.mutex1 );
list_for_each(&G.staList.stations, sta, staList)
{
printf("%02x:%02x\n", sta->mac[4],sta->mac[5]);
printf("Pwr:\t\tAverage: %d\tVariance: %d\tStanDev: %lf\n",sta->avgpower,sta->varpower, sta->sdpower);
}
//pthread_mutex_unlock( &G.mutex1 );
sleep(2);
}
}