Counters should be thread safe

Bug #863550 reported by Lucio Torre
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
txStatsD
In Progress
Medium
Ian Wilkinson

Bug Description

counters do:

self._count += value

in increment. this should be made thread safe so this can be called from any thread and not have to manage the serialization of calls outside of it.

Changed in txstatsd:
assignee: nobody → Ian Wilkinson (theiw)
Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 863550] [NEW] Counters should be thread safe

On Sat, Oct 1, 2011 at 7:29 AM, Lucio Torre <email address hidden> wrote:
> Public bug reported:
>
> counters do:
>
> self._count += value
>
> in increment. this should be made thread safe so this can be called from
> any thread and not have to manage the serialization of calls outside of
> it.

Thats a poor idea - taking a lock is /much/ more expensive than not,
and native twisted code is single threaded anyway.

I suggest you have a threaded version of the class, or something,
rather than penalising every caller. (Or is this in the server? if its
in the server, why is it threaded at all???)

Ian Wilkinson (theiw)
Changed in txstatsd:
status: New → In Progress
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.