-
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
Replace unistd functions with cross platform counterparts #3300
Conversation
Thanks to @flx42 for suggesting a truly cross platform temp dir. |
LGTM :) Replacing unistd.h with boost should make it easier to build caffe across platforms for community windows ports. |
You have another place where you are using "/tmp", I guess you could also remove it and use boost too. |
@ronghanghu thanks for looking at this. |
I plan to merge this PR, if other people don't object. |
👍 |
Are we not ready for tmpfile et al.? |
Replace unistd functions with cross platform counterparts
@bhack I appreciate difficulties running Boost on iOS and Android. In the meantime I'm not sure that C++11 is a silver bullet for cross-platform support. With a little more refactoring we'll be able to handle this. |
Did this solve the problem of potential race condition #1063? |
It seems not. #3324 |
The easiest solution is to add a macro USE_BOOST_FILESYSTEM and keep both versions. |
@futurely I think we are going to do this the hard way. |
I'm not sure if there is more occurrence of #3324 after this PR. Seems tricky to do a perfect fix to the race here. At this point the function is only used in test cases so I guess the race condition shouldn't affect too much. |
@ronghanghu I've seen a couple more. I think it's worth fixing. |
Via unistd.h, caffe uses a handful of functions not readily available on non-Unix systems; boost is cross platform and affords more concise, more readable implementations (notably, with reference to MakeTempFilename and MakeTempDir).
To support this, CMake and Make builds are updated to link against boost_filesystem.