the problem seem my thread....
Code:
rc = pthread_create(&threads, NULL, (void *)&writeFile, (void *)&prod);
if (rc) {
makehtml_syslog("**CRITICAL** return code from pthread_create() is %d\n", rc);
exit(-1);
}
writeFile function
Code:
void writeFile(production_t *prod)
{
while(1)
{
sleep(2);
writeWebPage(&prod);
if (newDay==true)
{
changeDay();
newDay=false;
}
if(runbHistory==true)
{
bHistoryWebPage();
runbHistory=false;
}
if(runHistory==true)
{
historyWebPage();
runHistory=false;
}
}
}
writewebpage function
Code:
void writeWebPage(production_t *prod)
{
//production_t prod[2];
char tmp_mnt_dir_www[75];
snprintf(tmp_mnt_dir_www, sizeof(tmp_mnt_dir_www),"%s/makehtml.lock", mnt_dir_www);
/*create lock file*/
createLockFile(tmp_mnt_dir_www);
/*picture page */
summaryWebPage(&prod);
/*information page on counter */
detailWebPage(&prod);
msgDisplayPanel();
/*remove file lock*/
removeFile(tmp_mnt_dir_www);
}