in reply to Re^2: initial walkthrough
in thread initial walkthrough
Please see threads::shared on how to share information between two threads. Usually a newly created copy of a process (fork) or a newly created copy of the Perl interpreter (threads) do not share data structures by default.
Perl would not complain while accessing shared data (neither warn you) - but you usually do not want to read information that is in the process of being manipulated by another thread at the same time. So, you need to synchronise access to this data (more details via link above). Is there a requirement, that the SNMP thread clears the information before starting another round? Otherwise, I do not understand the stale argument, since each information belonging to a certain IP is valid until updated? You might want to mark updated values with a flag or a time-stamp, but I would consider this too complicated. Why not simply let the SNMP thread use a callback to update the GUI whenever a network entry has been updated?
Sorry, I don't understand your sub. A HoH-entry is set to something seemingly constant unless this entry does not already exists. So the only information conveyed here between the threads is the existance of a newly found IP? Maybe you can describe a little bit more what is updated (sum of RX/TX values per IP?) and how it must be treated to produce a proper GUI update?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: initial walkthrough
by vortmax (Acolyte) on Oct 09, 2008 at 21:27 UTC |