more uninitialized mutexes in rc.39
Carter Bullard
carter at qosient.com
Mon Feb 26 19:54:28 EST 2007
Hey Christoph,
Took your suggestion to create ArgusNewHashTable. Calling convention
is:
(struct ArgusHashTable *) ArgusNewHashTable(size_t size)
and of course that made me have to create:
(void) ArgusDeleteHashTable(struct ArgusHashTable *);
And made your suggested changes, and found a few extra, ..., so, ....
Most Thanks!!!!!!!
Carter
On Feb 26, 2007, at 6:59 PM, Christoph Badura wrote:
> Hey Carter,
>
> I've found two more unintialized mutexes while playing around with
> racluster.
>
> Having to add mutex initialization to new uses of ArgusHashTables
> is getting
> old fast. What do you thing about hiding the common code to allocate
> a hash table behind a call to
>
> int ArgusNewHashTable(struct ArgusHashTable *htable, int nelem.
> size_t elemsz)?
>
> Usage would be like
>
> if (ArgusnewHashTable(&retn->htable, RA_HASHTABLESIZE, sizeof (void
> *)) != 0)
> ArgusLog (LOG_ERR, "ArgusNewAggregator: ArgusCalloc error %s",
> strerror(errno));
>
> to replace a randomly picked call common/argus_client.c.
>
> Meanwhile, attached are my patches to initialize the mutexes
> NetBSD's libpthread
> complains about.
>
> --chris
>
> --- common/argus_parser.c.orig 2006-11-10 17:34:49.000000000 +0100
> +++ common/argus_parser.c
> @@ -119,4 +119,8 @@ ArgusInitializeParser(struct ArgusParser
> parser->RaLabelCounter = 0;
>
> gettimeofday(&parser->ArgusRealTime, 0L);
> +
> +#if defined(ARGUS_THREADS)
> + pthread_mutex_init(&parser->lock, NULL);
> +#endif
> }
>
> --- common/argus_client.c.orig 2007-01-26 22:24:34.000000000 +0100
> +++ common/argus_client.c
> @@ -7241,6 +7241,10 @@ ArgusNewAggregator (struct ArgusParserSt
>
> retn->htable.size = RA_HASHTABLESIZE;
>
> +#if defined(ARGUS_THREADS)
> + pthread_mutex_init(&retn->htable.lock, NULL);
> +#endif
> +
> retn->RaMetricFetchAlgorithm = ArgusFetchDuration;
>
> return (retn);
>
More information about the argus
mailing list