Re: [Nagios-devel] Multithreading Segfaults :(

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

Re: [Nagios-devel] Multithreading Segfaults :(

Post by Guest »

Steven D. Morrey wrote:
> I think I've got it mostly worked out now. Turns out lots of
> functions call eachother, thereby producing a race. The trick seems
> to be to ONLY lock the sections of code dealing directly with macro_x
> and not just the entire function dealing with macro_x itself. I'm
> going to give it 12hrs of run time and then I'll get a patch up for
> testing.
>

The "right" way of doing that is to lock down the global arrays in a
single file and then publish a thread-safe API to manipulate it. The
thread-safeness can be taken care of by the simple expedient of adding
locks to start with, and later one can modify the functions so that
hostnames etc are added in a function-local stack-allocated array
instead, which could potentially increase performance quite a lot
(and also reduce memory fragmentation quite a bit).

--
Andreas Ericsson [email protected]
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked