Menu

#6 Asynchronous event data logging problem

open
nobody
Logging (3)
5
2004-03-22
2004-03-22
Anonymous
No

If I understand the code correctly, if an event log is
added in buffering enabled mode, since the event is
passed by reference, and the logging is done in a later
time, if the data part of the event is changed before
logging, this will effect the log.

As an example, suppose I'm using a binary formatter and
I pass an object as the data of an event. I then
continue with my code change a field of this data object.
Sometime after this change, the buffer is flushed and
the data is written to the log, but with data that is
differnet from the original one that was intended to be
written!

Is there any way to avoid this, maybe perform a deep
copy of the event data?

Shmulik Primes
shmulikp@paieon.com

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.