[AGENT++] about callbacl function for notify reciver

Leo Lei nsinit at 163.com
Mon Jan 15 08:50:45 CET 2007


Jochen Katz£º

	

======= 2007-01-13 04:20:39 =======

>Hi,

>pdu and target params are temporary objects/pointers, only use them
>within the callback. If you want to pass them to another thread you have
>to copy them.
yes i did as that.

>The session pointer is valid until your application deletes it.
>The data pointer (of async responses) has to be deleted by the callback,
>as snmp++ doesn't know anything about it.
>
>As the documentation states, you are not allowed to send any synchronous
>snmp requests from within the callback function.

i didn't use the data pointer, and don't care it.

>> in my current snmp_callback implemention, when my callback
>> function(mCallback) called, i new a CNMS_TrapInnerMsg class object
>> with two public data member pointer(Pdu*,SnmpTarget*), and then new a
>> pdu object constructed with the pdu reference from mCallback params
>> list,and then put the CNMS_TrapInnerMsg object in the queue of othere
>> ACE_Task thread, and mCallback return.   CNMS_TrapInnerMsg object is
>> deleted by ACE_Task thread after handling it. is it OK?
>
>If I understand this right, your code is not ok, as you don't copy the
>target object: depending on the target type you have to create a new
>SnmpTarget, CTarget or UTarget object.
i had create a new CTarget or UTarget object depending on the target type from the target param.
i am sorry that i didn't mention that in my last post. 

i put the pdu and target copied from the params in to the queue of another threads, my program will core dump.
strangely, when my mDebugCallback was defined as the same as the callback() in consoleExamples/receive_trap.cpp,
it's all OK!

my main loop:
        snmp.start_poll_thread(1000);
        // infinite loop
        while (run)
        {
        }
        snmp.stop_poll_thread();

i noticed that it's a single-threaded implementation, how can be implement a multi-threaded notification receiver 
depending on Snmp class?

thanks~ i hope i have expressed myself clearly~

>
>Regards,
>  Jochen
>_______________________________________________
>AGENTPP mailing list
>AGENTPP at agentpp.org
>http://lists.agentpp.org/mailman/listinfo/agentpp
>

= = = = = = = = = = = = = = = = = = = =

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡	Leo Lei
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡	2007-01-15
begin 600 core backtrace.txt
M4')O9W)A;2!R96-E:79E9"!S:6=N86P at 4TE'4T5'5BP at 4V5G;65N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