-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Cleanup pthread code for data layers #710
Conversation
Nice, this code has needed some cleanup for a while. Can you run "make lint" and fix the style errors it returns? (Or look at them in the Travis build output.) One thing I'm not sure about is the multiple inheritance -- the Google style guide pretty much forbids it, but I think I'd be okay with using it here (especially given that it's replacing a friend class, which seems more dangerous to me even though GSG is okay with them) unless there's some real danger -- anyone care to comment? |
All right, all fixed! For some reason "make lint" always returns no errors for me. I ran the cpp_lint.py script manually. Multiple inheritance is a feature of the language, and it makes no sense to avoid it all together. |
The use here is a good application of multiple inheritance and this kind of However I am not as well-versed in Google Style and its underlying reasons On Thu, Jul 17, 2014 at 12:40 PM, TANGUY Arnaud notifications@github.com
|
Get rid of the ugly "friend" thread function. Simplify the creation of the thread by inheriting from a base class. Thus, defining the thread is as simple as overriding a virtual function.
Alright, given that I have no real understanding of the potential issues associated with multiple inheritance, I'll defer to @GeenuX and @shelhamer's endorsements and merge. Thanks for the cleanup! |
Cleanup pthread code for data layers
Cleanup pthread code for data layers
Cleanup pthread code for data layers
While creating a new data layer class needed for my Siamese network, I noticed that the
pthread code wasn't particularely clean.
Thus I
This forced to pass a pointer to the current layer, and do needless casts and pointer checks.
It is done by inheriting the InternalThread class, and overriding the InternalThreadEntry virtual function to
define the thread's code. It has the necessary mechanism to start and wait for a thread.
This is my first contribution to Caffe, I hope I followed all the guidelines properly ;)
Cheers,
Arnaud