Atostek/RustDDS

Improve DDSCache locking

Closed this issue · 5 comments

Currently, there is one global lock to the DDSCache.

This should be replaced by per-topic locks. Reader/DataReader should only get a handle (Arc) to their own topic to avoid useless map lookups. Same for Writer/DataWriter.

jd509 commented

Hey @jhelovuo ! I can help take this up

Please go ahead. Is it clear for you what to do?

So DDSCache should not directly contain TopicCaches, but each wrapped in Arc<Mutex<>>.

To avoid duplicate work, please work on branch 0.8 instead of master.

Sorry @jhelovuo , I forgot how to pull requests, so some incorrect commits were generated above unexpectedly, please ignore them. I just replaced the type you mentioned with Arc<Mutex<TopicCache>> as what you guide us to do. Maybe these trivial replacements in this fork based on branch 0.8 can save you some time.

Hi @wangxiaochuTHU ! It seems like the master branch in your fork is based on an earlier version of the master branch from this repo, while still including some recent changes from the 0.8 branch. This makes it difficult to assess the actual changes that you are proposing. Could you redo your changes on top of the current 0.8 branch?

This functionality was merged into the branch 0.8 in the pull request #256.