18 nameMap =
new map<string, int>();
25 pthread_mutex_destroy(&
mapLock);
30 if (pthread_mutex_init(&
mapLock,NULL) != 0)
return false;
31 for (
int adx = 1; adx <=
maxAdm; adx++) {
33 if (pthread_cond_init(&
avec[adx].busyCond,NULL) != 0)
70 map<string, int>::iterator p =
nameMap->find(aname);
73 while (
avec[adx].busyBit) {
77 pthread_cond_signal(&
avec[adx].busyCond);
93 pthread_cond_signal(&
avec[adx].busyCond);
103 int adx =
admins->firstIn();
105 while (
avec[adx].busyBit) {
109 pthread_cond_signal(&
avec[adx].busyCond);
127 int nuAdx =
admins->nextIn(adx);
130 pthread_cond_signal(&
avec[adx].busyCond);
134 while (
avec[nuAdx].busyBit) {
136 nuAdx =
admins->nextIn(adx);
139 pthread_cond_signal(&
avec[adx].busyCond);
140 pthread_cond_signal(&
avec[nuAdx].busyCond);
147 pthread_cond_signal(&
avec[adx].busyCond);
167 map<string,int>::iterator p =
nameMap->find(aname);
170 if (
admins->isIn(adx)) adx = 0;
175 nameMap->insert(pair<string,int>(aname,adx));
197 pthread_cond_signal(&
avec[adx].busyCond);
210 string aname, pwd, realName, email;
212 if (!in.good())
return false;
228 if (
addAdmin(aname, pwd, adx) == 0)
return false;
248 cout <<
"read " << i <<
" admin records, producing "
249 <<
admins->getNumIn() <<
"table entries\n";