Ticket #508 (closed Enhancement: fixed)

Opened 7 months ago

Last modified 5 months ago

Recursive critical sections

Reported by: Nicolas Assigned to: ballen
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

recursive-critical-sections.diff (2.6 kB) - added by Nicolas on 11/23/07 16:50:42.
Patch
recursive-critical-sections2.diff (2.5 kB) - added by Nicolas on 11/23/07 16:55:15.
Modified patch, abstracting crit. sections from checkpoint code.
recursive-critical-sections3.diff (2.5 kB) - added by Nicolas on 11/23/07 17:10:55.
Fixed stupid mistake (inverted conditions)

Change History

11/23/07 16:50:42 changed by Nicolas

  • attachment recursive-critical-sections.diff added.

Patch

11/23/07 16:55:15 changed by Nicolas

  • attachment recursive-critical-sections2.diff added.

Modified patch, abstracting crit. sections from checkpoint code.

11/23/07 17:09:43 changed by Nicolas

Wait, that's totally wrong. !in_critical_section should be replaced with in_critical_section == 0, not in_critical_section > 0!

11/23/07 17:10:55 changed by Nicolas

  • attachment recursive-critical-sections3.diff added.

Fixed stupid mistake (inverted conditions)

02/05/08 15:42:56 changed by Nicolas

  • keywords set to patch.

02/06/08 12:39:12 changed by davea

  • status changed from new to closed.
  • resolution set to fixed.

(In [14694]) - API: critical section begin/end calls can be nested

Fixes #508 (from Nicolas)


If this page is incomplete or incorrect, please edit it or add it to the wiki to-do list. To do this, you must be logged in; click Login or Register above.