portable FastCriticalSection implementation

Bug #617757 reported by Gennady Proskurin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
DC++
Fix Released
Undecided
Unassigned
LinuxDC++
Confirmed
Low
Unassigned

Bug Description

patch attached.
It may have benefits on win32, the old implementation used sleep(1) in "fast" critical section (Thread::yield).
Now Thread::yield seems to be unused, I think it should be removed, it's dangerous. Incorrectly using scheduler's yield may lead to unnecessary cpu consumption.

I tested only unix after patching this.

Tags: core

Related branches

Revision history for this message
Gennady Proskurin (gpr) wrote :
tags: added: core
Revision history for this message
Steven Sheehy (steven-sheehy) wrote :

Gennady, these patches you've submitted modify both the windows and linux core, so they would need to be reviewed by the dcplusplus team. We cannot apply changes to linuxdcpp without them also being applied to upstream dc++. The only one that is linux specific is bug #617021, which me or Razzloss can review.

However, your patches/branch are for linuxdcpp which is not up to date with the latest dc++ core. You may have to redo your patches for the dc++ core. But before you do that, I would suggest waiting on a response from the dc++ team to see if they would be interested in your patches before you go through that effort.

Poy et al, can you take a look at these patches that Gennady submitted (this and the other bugs he filed)? They probably won't apply, but you can get an idea from the diff and if it's something that you approve of either Gennady or I can port it to the new core.

Revision history for this message
Big Muscle (bigmuscle) wrote :

I completely removed CriticalSection stuff from StrongDC++ and use only following typedefs:

typedef boost::recursive_mutex CriticalSection;
typedef boost::detail::spinlock FastCriticalSection;
typedef boost::lock_guard<boost::recursive_mutex> Lock;
typedef boost::lock_guard<boost::detail::spinlock> FastLock;

Revision history for this message
Gennady Proskurin (gpr) wrote :

I agree, these typedefs are better than my patch.
The only drawback I see is that recursive_mutex and lock_guard are not garanteed to be header-only.

eMTee (realprogger)
Changed in dcplusplus:
status: New → Fix Committed
Revision history for this message
Steven Sheehy (steven-sheehy) wrote :

Will be integrated with next core upgrade.

Changed in linuxdcpp:
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
poy (poy) wrote :

Fixed in DC++ 0.780.

Changed in dcplusplus:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.