Excellent thank you.  I was thinking about doing exactly the same copy due to 
the problem of not knowing when I can unlock the mutex.

I am also considering having an 'updated' flag which will be set when the data 
is updated, then when get_first_data_point is called I know if I need to take a 
new copy or not.

Cheers
Graeme.
 

> -----Original Message-----
> From: Olivier Beytrison [mailto:[EMAIL PROTECTED] 
> Sent: 20 December 2006 10:17
> To: Graeme Wilson
> Cc: net-snmp-coders@lists.sourceforge.net
> Subject: Re: Question regarding the Iterator method
> 
> 
> 
> Graeme Wilson a écrit :
> >>I plan to use a simple mutex to avoid the linked list to be 
> >>read/written at the same time. The application won't be 
> under a heavy 
> >>load so this isn't a critical point imo.
> >>
> >>Olivier B.
> >>
> > 
> > 
> > Oliver,
> > Where do you plan on locking/unlocking the mutex in the 
> subagent code?
> > The obvious place to lock it is in get_first_data_point, but there 
> > doesn't seem to be such an obvious place to unlock it.
> > 
> > I ask because I am writing some similar code and have been looking 
> > into this same issue.
> > 
> > Cheers
> > Graeme.
> >
> >  
> 
> At the begining, i planned to directly read through the 
> original datas. 
> But finally i choosed another method. once the 
> get_first_data_point is called, i'm locking the structure 
> with a mutex, then duplicate all the elements in the list, 
> and use the copy insteed of the original one. Once it's done, 
> i release the mutex, which allow other thread to update it again.
> 
> Hope it will help
> 
> Regards,
> 
> Olivier B.
> 
> -----
> Olivier Beytrison
> Student in Telecommunication
> University of Applied science
> Fribourg - Switzerland
> 
> 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to