#508 closed Enhancement (fixed)
Recursive critical sections
| Reported by: | Nicolas | Owned by: | Bruce Allen |
|---|---|---|---|
| Priority: | Trivial | Milestone: | Undetermined |
| Component: | BOINC - API | Version: | |
| Keywords: | patch | Cc: |
Description
If an application uses critical sections recursively, or uses a critical section during a checkpoint, the first boinc_end_critical_section call ends the critical section "prematurely". It would be better to change in_critical_section to be an int instead of a bool to keep the recursion count, and consider it shouldn't suspend if in_critical_section > 0
I'm attaching a patch that does this, to lower the work needed in case you actually think my enhancement suggestion is a good idea :) I changed !in_critical_section to >0. This is technically not needed since (!foo) == (foo!=0), but I think it's cleaner to have the comparison explicit.
(of course, feel free to resolve as wontfix if you disagree on the usefulness of the change)
Attachments (3)
Change History (6)
Changed 18 years ago by
| Attachment: | recursive-critical-sections.diff added |
|---|
Changed 18 years ago by
| Attachment: | recursive-critical-sections2.diff added |
|---|
Modified patch, abstracting crit. sections from checkpoint code.
comment:1 Changed 18 years ago by
Wait, that's totally wrong. !in_critical_section should be replaced with in_critical_section == 0, not in_critical_section > 0!
Changed 18 years ago by
| Attachment: | recursive-critical-sections3.diff added |
|---|
Fixed stupid mistake (inverted conditions)
comment:2 Changed 18 years ago by
| Keywords: | patch added |
|---|
comment:3 Changed 18 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |

Patch