-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid creating new set of threads every frame #8
Comments
I suggest we use boost for this:
This allows you to spawn a pool of thread and then send them a pointer to a function to execute using |
Does this approach require joining the thread at each frame? I had a quick glance at the codebase and I found some questionable design choices that I don't quite understand. |
I think the reason why everything is a shared_ptr is because there is a mutex in the Subject class. Again I fail to understand why this is needed. The only way a mutex is necessary is when functions like
will return duplicate |
Not that I know of, this is why I suggested it. |
I'm not an expert in asio, but my understanding is one can just call Also I'd love to get rid of all these random mutexes if possible. My personal preference would be TBB of course, but using asio is also ok since we already depend on boost. |
Yes, I suggest to do this:
I personally prefer boost as it's:
|
Cool, this looks good. If you can do another PR, I'd be happy to review and merge it. |
I won't have time to do this before end of June but I will try later on. |
If I do this I could also update the mutex problem. |
There's no hurry, I'm not sure how many people in our lab are using this atm. My quick scan through the code shows that there's one mutex per Subject, which makes it non-copyable. If we remove it we can just use Subject instead of SubjectPtr. |
Creating and destroying threads at each frame seems like a lot of overhead, maybe can keep the threads running and signal it when new data arrives.
The text was updated successfully, but these errors were encountered: