-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Slim Reader/Writer lock to replace CRITICAL_SECTION (better perfo…
…rmance). Use One-Time Initialization for glyph caching to avoid duplicate glyph generation. Use thread local storage in stream I/O of font manager to avoid transient GDI font selection.
- Loading branch information
Crend King
authored and
Crend King
committed
Jan 10, 2012
1 parent
5567543
commit 2614a08
Showing
31 changed files
with
298 additions
and
743 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include "stdafx.h" | ||
#include "scoped_rw_lock.h" | ||
|
||
namespace gdipp | ||
{ | ||
|
||
std::vector<SRWLOCK> scoped_rw_lock::_srws; | ||
|
||
void scoped_rw_lock::initialize() | ||
{ | ||
_srws.resize(LAST_MONITOR_LOCATION); | ||
for (int i = 0; i < LAST_MONITOR_LOCATION; ++i) | ||
InitializeSRWLock(&_srws[i]); | ||
} | ||
|
||
scoped_rw_lock::scoped_rw_lock(MONITOR_LOCATION cs_location, bool is_shared) | ||
{ | ||
_curr_srw = &_srws[cs_location]; | ||
_is_shared = is_shared; | ||
|
||
if (is_shared) | ||
AcquireSRWLockShared(_curr_srw); | ||
else | ||
AcquireSRWLockExclusive(_curr_srw); | ||
} | ||
|
||
scoped_rw_lock::~scoped_rw_lock() | ||
{ | ||
if (_is_shared) | ||
ReleaseSRWLockShared(_curr_srw); | ||
else | ||
ReleaseSRWLockExclusive(_curr_srw); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#pragma once | ||
|
||
#include "gdipp_lib/api.h" | ||
|
||
namespace gdipp | ||
{ | ||
|
||
class GDIPP_API scoped_rw_lock | ||
{ | ||
public: | ||
enum MONITOR_LOCATION | ||
{ | ||
CLIENT_COM_HOOK, | ||
CLIENT_GAMMA, | ||
CONFIG_RENDER_CACHE, | ||
CONFIG_RENDER_CONFIG_DELTA_CACHE, | ||
GLOBAL_DEBUG, | ||
LIB_LRU, | ||
SERVER_DC_POOL, | ||
SERVER_FONT_MGR, | ||
SERVER_FREETYPE, | ||
SERVER_GLYPH_CACHE, | ||
SERVER_GLYPH_RUN_CACHE, | ||
|
||
LAST_MONITOR_LOCATION | ||
}; | ||
|
||
public: | ||
static void initialize(); | ||
|
||
explicit scoped_rw_lock(MONITOR_LOCATION srw_location, bool is_shared); | ||
~scoped_rw_lock(); | ||
|
||
private: | ||
static std::vector<SRWLOCK> _srws; | ||
|
||
SRWLOCK *_curr_srw; | ||
bool _is_shared; | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.