bug: reference counter increment/decrement not atomic

Open
#6 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
c

Research direction

Start by locating the definition and reference-count operations for rtcan_msg_t. Review how messages are accessed concurrently and compare the synchronization approaches described in the issue; done means increments and decrements are thread-safe without breaking message handling or imposing an unacceptable shared-lock cost.

Written by the indexing model from the issue text.

Description

bug priority
Description

Incrementing and decrementing of the reference count in rtcan_msg_t is not atomic and therefore not thread safe.

Expected Behaviour

Reference count implemented in thread-safe manner.

Additional Notes
  • Could use a semaphore for each RTCAN message, though there is a large memory cost there.
  • Could also have a "reference count mutex" which locks ALL reference counts, this is less costly in terms of memory but could slow things down.
Dominant language
C
Stars
4
Forks
0
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sufst/rtcan

All issues in sufst/rtcan

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.