int main(int argc, char** argv)
{
pthread_t threads[NUMBER_OF_SERVERS];
int i,j;
if(pthread_mutex_init(&MUTEX, NULL))
{
cout<<"Unable to initialize a MUTEX"<<endl;
return -1;
}
Server<int> servs[NUMBER_OF_SERVERS];
for(i = 0; i < NUMBER_OF_SERVERS; i++)
{
servs[i].setServerNum(i);
pthread_create(threads+i, NULL, server_work, (void *)&servs[i]);//<<--compiler flags here
}
// Synchronization point
for(i = 0; i < NUMBER_OF_SERVERS; i++)
{
pthread_join(*(threads+i), NULL);
}
cout<<"SERVER-NO\tCUSTOMER-NO\tARRIVAL-TIME\tWAITING-TIME\tTRANSACTION-TIME"<<endl;
for(i = 0; i < NUMBER_OF_SERVERS; i++)
{
for(j=0; j<servs[i].getCustomersServed(); j++)
{
cout<<i<<"\t\t"<<servs[i].getCustomers()[j].getCustomerNumber()<<"\t\t"<<servs[i].getCustomers()[j].getArrivalTime()<<"\t\t"<<servs[i].getCustomers()[j].getWaitingTime()<<"\t\t"<<servs[i].getCustomers()[j].getTransactionTime()<<endl;
}
}
cout<<endl;
cout<<endl;
i get the folloiwng error from the compiler:
main.cpp:84:71: error: no matches converting function ‘server_work’ to type ‘void* (*)(void*)’
main.cpp:26:8: error: candidate is: template<class Type> void* server_work(void*)