[AGENT++] can i use two thread, one to update data, the other processrequest?
hyznull
hyznull at hotmail.com
Mon Nov 11 10:44:42 CET 2013
hi
i want to make 2 thread,threadProcess is wait to process request,and the other threadUpdate will clear the content,and add the row again after sleep function.can i use this way to update my data?
void threadProcessReqest
{
while (1)
{
req = reqList->receive(10);
if (req)
{
mib->process_request($req);
}
}
}
void threadUpdate
{
MibTableInstance->content.clearAll();
for(int i = 0;i < GetSizeFromMem();i++)
{
MibTableRow* r = MibTableInstance->add_row(index_inner);
r->get_nth(0)->replace_value(new SnmpInt32(/*new value1*/));
r->get_nth(1)->replace_value(new SnmpInt32(/*new value2*/));
}
sleep(1000)
}
int main()
{
//step1:init snmp & agent
//step2:Create thread bind to threadUpdate
//step3:Create thread bind to threadProcessReqest
//step4:wait to exit
return 0;
}
Thank you
More information about the AGENTPP
mailing list