bbl-usd-rs's People
bbl-usd-rs's Issues
Threading Model (๐ฌ)
I've started to use the crate in a multithreaded way and it's proving to be a little bit of a pain. According to https://openusd.org/dev/api/_usd__page__multi_threading.html, the USD threading model is essentially the same as Rusts: multiple readers or a single writer. It should be valid to unsafe impl
both Send
and Sync
for everything.
Currently, essentially all methods take &self
, e.g.
pub fn prim_at_path<P: Into<sdf::Path>>(&self, path: P) -> Result<Prim, Error>;
This is problematic when modifying a prims attributes comes into consideration, as currently this will allow writing to the stage from two seperate threads which (usually) results in a segfault.
you could have two seperate methods for read/write vs read-only prims:
pub fn prim_at_path_<P: Into<sdf::Path>>(&self, path: P) -> Result<Prim, Error>;
pub fn prim_mut_at_path<P: Into<sdf::Path>>(&mut self, path: P) -> Result<PrimMut, Error>;
But this doesn't properly reflect the fact that both prim types are effectively borrowing the stage they exist within, meaning that you could keep a PrimMut
around after the write-access to the stage has ended. Adding lifetime annotations is probably a no-go as well.
A better solution is to wrap the whole stage in an Arc
'd RwLock
of some kind, and clone that when accessing any prim or attribute, locking it for either read or write depending on what's being read out. Implementing this would be a massive pain though and you'd probably want two implementations for both blocking and async locks.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.