On 5/25/09, Matthias Urlichs <sm...@smurf.noris.de> wrote: > Hi, > > 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? > > > Anyway, I wonder about the thread-safe-ness of this code in OW_get(): > > if (ret >= 0) { > *buffer = OWQ_buffer(&owq); > if (buffer_length != NULL) { > *buffer_length = OWQ_size(&owq); > } > } > FS_OWQ_destroy(&owq); > > My naïve reading of this code says that the buffer is either part of > the owq struct, in which case it'll be gone after FS_OWQ_destroy() is > called -- or not, which presumably will cause it to be overwritten by > another thread. > I checked on this code in owcapi. See http://owfs.cvs.sourceforge.net/viewvc/owfs/owfs/module/owcapi/src/c/owcapi.c?revision=1.44&view=markup
owq is created by FS_OWQ_Create which bundles the original buffer with an elaborate "parsedname" structure from the analysis of the path. FS_OWQ_destroy cleans of the parsedname structure but leas the original buffer untouched. Using it is still safe. See http://owfs.cvs.sourceforge.net/viewvc/owfs/owfs/module/owcapi/src/c/owcapi.c?revision=1.44&view=markup Paul Alfille ------------------------------------------------------------------------------ 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