Menu
Logged-In As
ACCOUNTNot Logged In
Implement mutex locking for WindowsBRL-CAD
Status: ClosedTime to complete:
48 hrs
Mentors: Sean, Daniel Rossberg
BRL-CAD implements support for running in parallel on computers with multiple CPUs or cores. However, there are lots of ways to run in parallel. BRL-CAD runs on Windows, but presently only in a single-threaded mode. To make it work in parallel, we need to define how threads acquire a mutex lock. This task involves implementing the necessary logic to acquire and release a mutex or semaphore on Windows. You can use either, but probably want to call CreateMutex(). This requires a very minor source code modification to just one file, but make sure it works with a simple test program. Make your test program call bu_semaphore_init()+bu_semaphore_acquire()+bu_semahpore_release(), see include/bu.h for API docs. References:
Code:
|
Uploaded Work
File name/URL | File size | Date submitted | |
---|---|---|---|
semaphore.c | 12.8 KB | December 09 2012 01:50 UTC | |
semaphore.patch | 1.5 KB | December 09 2012 02:01 UTC | |
semaphore.patch | 1.7 KB | December 09 2012 22:20 UTC | |
semaphore.patch | 1.8 KB | December 11 2012 02:36 UTC | |
semaphore.patch | 2.1 KB | December 11 2012 02:41 UTC | |
semaphore.patch | 1.7 KB | December 12 2012 00:05 UTC |
I would like to work on this task.
This task has been assigned to Arjun Govindjee. You have 48 hours to complete this task, good luck!
The work on this task is ready to be reviewed.
I submitted a patch as suggested on your website. I created it with SVN diff, is this OK, or should I use the bsd diff utility?
Melange has detected that the deadline has passed and no more work can be submitted. The submitted work should be reviewed.
One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.
The deadline of the task has been extended with 1 days and 0 hours.
Nice work, only a couple minor issues I see...
Instead of including windows.h directly, you should include our "bio.h" header (before bu.h, after math.h).
Your indentation is wrong. We use a mix of tabs and spaces. See our HACKING file for style guidelines or you can look at our existing code to try and match it exactly. Basically the indentation levels are 4spaces, 1tab, 1tab+4spaces, 2tabs, 2tabs+4spaces, etc., not just tabs and not just spaces.
Lastly, did you attempt to compile the code? Did you try to run it?
Ok i can fix the indentation pretty easily, when I first read the vi tabstop instructions I was a little confused because well it seemed like it was mixing tabs and spaces (which to me is quite unusual). I can fix the header include too.
I can compile the code with no errors, but I have one question, how can I test it? I wrote a test program, but I cannot compile it, myself being unfamiliar with visual c++ express 2010, because I don't know how to set up a project with the correct access to include files and libraries, etc. Any advice on that would be helpful.
The work on this task is ready to be reviewed.
Ok, I managed to test the code, and it does indeed work (I had to use CMake to create the Visual Studio project - something I had not anticipated). I fixed the indents and included bio.h too.
Now I'm actually finished :)
Melange has detected that the deadline has passed and no more work can be submitted. The submitted work should be reviewed.
because it refers to files I don't have ;)
Please modify the file inside your subversion checkout (i.e. src/libbu/semaphore.c). Subversion will take care of your lokal changes and should generate a nice patchfile of these changes vs. the version on the surceforge server.
One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.
The deadline of the task has been extended with 1 days and 0 hours.
I hope I got it right this time (the very last file I submitted - look at the time)...I've never used svn before (I use git and at that I never make patch files). What I did this time was I checked out the latest revision and used "Create patch..."
Before I had been using the TortoiseSVN diff viewer program and clicking "create unified diff file", which evidently creates something very different than create patch.
-Arjun
The work on this task is ready to be reviewed.
BTW, you can open your patch-file in a text editor. This is what I do to have a first look at your results.
One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.
The deadline of the task has been extended with 1 days and 0 hours.
The work on this task is ready to be reviewed.
Wow...svn is really messing me up...
Basically here is the whole story:
I downloaded the "source" package from sourceforge instead of using svn originally.
That package did not yet have the typo fix for aquire, so when I used the version from svn to make the patch, it created that false fix.
I had thought that I had removed it and fix the whole issue before uploading, but I guess I messed up.
About the windows.h...I have no idea how that is still there...I removed that when I included bio.h.
Again, I apologize for my extreme incompetence with svn and patch files, especially on windows :(
I think I'll be using linux from now on (if I do more BRLCAD projects) so it will be easy to manage everything with svn and not screw up again. (Windows + Coding + No Experience Coding on Windows = Disaster...)
-Arjun
Melange has detected that the deadline has passed and no more work can be submitted. The submitted work should be reviewed.
The patch has to be tested more extensively than I did but this would be a different task. So far: Well done!
Congratulations, this task has been completed successfully.
A follow-on task has been posted:
http://www.google-melange.com/gci/task/view/google/gci2012/8095204
As GCI comes to a close, we wanted to take the time to say THANK YOU for all your efforts. This comment interface closes after GCI is over, so you're encouraged to join our mailing list where we'll be announcing contributions from GCI participants like yourelf over the upcoming months:
https://lists.sourceforge.net/lists/listinfo/brlcad-news
If you've provided your full name, we'll be sure to credit you in our authorship documentation and you'll see your name in a future announcement. If you contact us at devs@brlcad.org or via IRC, we'll even let you know when your work is integrated and follow up with updates. You're welcome and encouraged to contact us any time, especially if you have a question about how to continue participating in Open Source after GCI is over, but even if just to keep in touch. Note that ongoing participation in Open Source is one of the most impressive skills to have on your resumé. Take care, be well, and thank you again!