R
Ramesh
Hello,
I am writing an application in linux using timer_create API to create
timers in my application, I have registered a call back routine which
would be called when the timer timesout. I get the following error:
-------
test.cpp: In member function 'unsigned long
testMgr::addConfigChangeTimer(unsigned long)':
test.cpp:125: error: argument of type 'void (testMgr:(sigval_t)'
does not match 'void (*)(sigval_t)'
------
The compiler expects a function returning void and taking a sigval_t
as argument, in my case the only difference is that the linkage is C++
style and its a member function.
Is there a way I can assign a member function to the notify_function
pointer?
Thanks
/R
Here is the code snippet:
---
// Actual point of assignment of the callback function to the signal
handler
unsigned long testMgr::addConfigChangeTimer(unsigned long interval) {
timer_t id = 0;
int count = 0;
struct sigevent sig;
struct itimerspec timerspec;
memset(&timerspec, 0, sizeof(struct itimerspec));
memset(&sig, 0, sizeof(struct sigevent));
sig.sigev_notify = SIGEV_THREAD;
sig.sigev_notify_function = ConfigChangeHandler;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sig.sigev_value.sival_ptr = (void*)&count
-------
// Actual function
void testMgr::ConfigChangeHandler(sigval_t value) {
ACE_Guard<ACE_Thread_Mutex> guard(tMutex);
if (ConfigChange == TRUE) {
Notifythreads();
ConfigChange = FALSE;
}
trace("Config change timeout process completed");
}
----
// Class definition
class testMgr {
private:
timestamp ChangeTime;
BOOL ConfigChange;
ACE_Thread_Mutex tMutex;
public:
testMgr();
~testMgr();
UINT32 addConfigChangeTimer(UINT32);
void entConfigChangeHandler(sigval_t );
};
I am writing an application in linux using timer_create API to create
timers in my application, I have registered a call back routine which
would be called when the timer timesout. I get the following error:
-------
test.cpp: In member function 'unsigned long
testMgr::addConfigChangeTimer(unsigned long)':
test.cpp:125: error: argument of type 'void (testMgr:(sigval_t)'
does not match 'void (*)(sigval_t)'
------
The compiler expects a function returning void and taking a sigval_t
as argument, in my case the only difference is that the linkage is C++
style and its a member function.
Is there a way I can assign a member function to the notify_function
pointer?
Thanks
/R
Here is the code snippet:
---
// Actual point of assignment of the callback function to the signal
handler
unsigned long testMgr::addConfigChangeTimer(unsigned long interval) {
timer_t id = 0;
int count = 0;
struct sigevent sig;
struct itimerspec timerspec;
memset(&timerspec, 0, sizeof(struct itimerspec));
memset(&sig, 0, sizeof(struct sigevent));
sig.sigev_notify = SIGEV_THREAD;
sig.sigev_notify_function = ConfigChangeHandler;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sig.sigev_value.sival_ptr = (void*)&count
-------
// Actual function
void testMgr::ConfigChangeHandler(sigval_t value) {
ACE_Guard<ACE_Thread_Mutex> guard(tMutex);
if (ConfigChange == TRUE) {
Notifythreads();
ConfigChange = FALSE;
}
trace("Config change timeout process completed");
}
----
// Class definition
class testMgr {
private:
timestamp ChangeTime;
BOOL ConfigChange;
ACE_Thread_Mutex tMutex;
public:
testMgr();
~testMgr();
UINT32 addConfigChangeTimer(UINT32);
void entConfigChangeHandler(sigval_t );
};