[Matthias Urlichs] > Steinar Midtskogen: > > * When it's time to write to the log file, the parent will cancel > > all the threads, process all data from every thread (average, max, > > min, whatever to be logged etc) and log to file. > > > > Hmm. Thread canceling might cause problems > (memory leaks? Non-released locks?). > > Why not just add a lock around accesses to the relevant data structures?
The idea behind the design is to able to access several owservers simultaniously; my 1-wire network is pretty big and I've split it into several seperate 1-wire adapters. More important, when one owserver is unreachable, offline, its physical bus is having problems etc and OW_get uses forever to return, that must not prevent data collection from other available sources. So when it's time to write to file, I don't want to wait for OW_get to return (which might be minutes). And it's convenient to leave all the queueing stuff to owserver. I quickly found out that in order to achieve this, I need one process per source with its own OW_init, whereas OW_get seems to be threadsafe, but just in case I can have the program use fork instead of pthread_create, but I have the same two issues regardless of whether I use threads or separate processes. Anyway, I've seen owserver die before I ever cancel anything, so this is not the cause here. And before any memory leaks can cause much damage as well. I've tried to run valgrind on my program and there are issues, though. Nearly all, however, seems to be stuff in the owcapi library and probably fairly innocent, like reading 8 byte chunks past the end of the buffer. -- Steinar ------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://www.creativitycat.com _______________________________________________ Owfs-developers mailing list Owfs-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/owfs-developers