hmmm loooks like i got half my answer.
class LogBase
{
...
void logUpdate(); //this runs and if condition is met a thread is created and runs the AsyncWriteLine() function
void *AsynchWriteLine(void *pThrdStruct); //a fileIO function that is to run as separate thread
}
class LogBase
{
...
void logUpdate(); //this runs and if condition is met a thread is created and runs the AsyncWriteLine() function
void *AsynchWriteLine(void *pThrdStruct); //a fileIO function that is to run as separate thread
}
To copy to clipboard, switch view to plain text mode
and the implelentation
void LogBase::logUpdate()
{
FileTime CurTime;
CurTime=GetTime(); //get the Time from epoch
if (CurTime>=Period+PrWriteTime)
{
memcpy(pThrdArg,SensSt,sizeof(ThreadPass)); // struct ThreadPass *pThrdArg;
// is the struct of args for the thread
pthread_t thrdWrt;
pthread_create(&thrdWrt,NULL,AsynchWriteLine,(void *)pThrdArg); //this lines doesn't compile
PrWriteTime=CurTime;
}
}
void *LogBase::AsynchWriteLine(void *pThrdStruct)
{
ThreadPass * pThrdData = (struct ThreadPass *) pThrdStruct;
....
....
}
void LogBase::logUpdate()
{
FileTime CurTime;
CurTime=GetTime(); //get the Time from epoch
if (CurTime>=Period+PrWriteTime)
{
memcpy(pThrdArg,SensSt,sizeof(ThreadPass)); // struct ThreadPass *pThrdArg;
// is the struct of args for the thread
pthread_t thrdWrt;
pthread_create(&thrdWrt,NULL,AsynchWriteLine,(void *)pThrdArg); //this lines doesn't compile
PrWriteTime=CurTime;
}
}
void *LogBase::AsynchWriteLine(void *pThrdStruct)
{
ThreadPass * pThrdData = (struct ThreadPass *) pThrdStruct;
....
....
}
To copy to clipboard, switch view to plain text mode
so if i try to compile i get
logger.cpp: In member function `void LogBase::logUpdate()':
logger.cpp:281: error: argument of type `void*(LogBase:: )(void*)' does not
match `void*(*)(void*)'
any ideas what i have missed?
nass
Bookmarks