Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#5319 closed Bug (fixed)

potential race condition when counting torrents

Reported by: livings124 Owned by: livings124
Priority: Lowest Milestone: 2.80
Component: Mac Client Version: 2.77
Severity: Trivial Keywords:
Cc:

Description (last modified by livings124)

Enumerating the torrents to filter and count the amount of downloading, seeding, paused, and active has a theoretical race condition when incrementing the counters. We should use OSAtomicAdd32() (or similar) when incrementing.

Change History (4)

comment:1 Changed 8 years ago by livings124

  • Resolution set to fixed
  • Status changed from new to closed

comment:2 Changed 8 years ago by livings124

  • Description modified (diff)

r14044 Use OSAtomicIncrement32(&value) instead of OSAtomicAdd32(1, &value)

comment:3 Changed 8 years ago by MechMK1

Where exactly is the difference between incrementing an atomic value and adding +1 to it?

comment:4 Changed 8 years ago by livings124

If the addition operation isn't atomic, and addition operation could happen in the middle of another addition operation, causing an inaccurate final number.

Note: See TracTickets for help on using tickets.