[libcxx-commits] [PATCH] D67086: Implement syncstream (p0053)

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Oct 28 08:10:52 PDT 2019


zoecarver marked an inline comment as done.
zoecarver added inline comments.


================
Comment at: libcxx/include/syncstream:220
+{
+    mutex_ptr_type __mtx = __mtx_ptr_map[__obuf];
+
----------------
zoecarver wrote:
> mclow.lists wrote:
> > How do entries get removed from `__mtx_ptr_map`?
> > 
> They don't. I don't think there is any way to say "will any threads ever need to access this streambuf again?" 
> 
> If there was a way to only keep the streambuf in the static map while the object is active, I would be open to that. But, I am hesitant to do that because I want to keep the read/writes to the map as low as possible. 
> 
> What would you suggest? 
Given the "new" structure of `__mtx_ptr_map`, I think I can add a function to remove elements from the map safely. Would this be a good thing to add (the only reason it might not is for performance but, I think stale memory outweighs performance here)?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67086/new/

https://reviews.llvm.org/D67086





More information about the libcxx-commits mailing list