Commit Graph

11 Commits

Author SHA1 Message Date
Norbert Federa
3a58934eb2 libwinpr-utils: Use criticalsection with spincount
Use InitializeCriticalSectionAndSpinCount instead of IntializeCriticalSection.
Using spin counts for critical sections of short duration enables the calling
thread to avoid the wait operation in most situations which can dramatically
improve the overall performance on multiprocessor systems.

On Linux this change has no effect because the new winpr critical section
implementation does not use the SpinCount field under Linux because the NPTL
synchronization primitives are implemented using the extremely performant
futex system calls which have this magic already built in.

However, on Mac OS X this change improved the overall performance of the
multithreaded RemoteFX decoder by 25 percent.

I've used a SpinCount of 4000 which avoided 99 percent of the wait calls.
This value is also used by Microsoft's heap manager for its per-heap
critical sections.

Note: This change requires pull request #1397 to be merged.
2013-08-07 18:16:01 +02:00
Norbert Federa
81ef251fc8 winpr: improve and fix locking for data structures
- Improved/completed(almost) winpr's critical section implementation
- Replaced WaitForSingleObject locking with critical sections

Note:
WaitForSingleObject should _never_ be used for granular low-contention
locks as it _always_ enters the kernel.

Just replacing WaitForSingleObject locking in Bufferpool with
EnterCriticalSection boosts the multithreaded rfx decoder
performance by almost 400% on win32.
2013-08-02 12:07:05 +02:00
Daryl Poe
86156ce61f fix memory errors due to too-large memcpy in ArrayList 2013-06-03 09:30:14 -06:00
Christian Hofstaedtler
8833c14eac fix ArrayList_Shift for args (al, 0, -1)
As a result, this should fix #1051.
2013-03-12 23:21:42 +01:00
Marc-André Moreau
7ff2be09b2 libfreerdp-core: more TSG memory cleanup 2012-12-12 22:03:40 -05:00
Marc-André Moreau
d3e0537d0d libfreerdp-core: more TSG memory cleanup 2012-12-12 00:49:15 -05:00
Marc-André Moreau
3aeb9eb197 libfreerdp-core: TSG partial cleanup 2012-12-11 23:34:51 -05:00
Marc-André Moreau
731e606c15 libfreerdp-core: start handling client call state 2012-12-07 21:09:55 -05:00
Marc-André Moreau
be98cffbd2 libwinpr-utils: fix ArrayList 2012-12-07 19:40:44 -05:00
Marc-André Moreau
5a131688e4 libwinpr-utils: implement ArrayList 2012-12-05 17:24:01 -05:00
Marc-André Moreau
c06c0fe665 libwinpr-utils: stubbed Queue, Stack and ArrayList 2012-11-30 16:13:19 -05:00