MCPcopy Create free account
hub / github.com/ValveSoftware/openvr / CacheMapThread

Function CacheMapThread

samples/hmd_opencv_sandbox/common_hello.cpp:82–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80og_sema_t g_mFileTimeRequestMutex;
81
82static void CacheMapThread()
83{
84 do
85 {
86 //Alow time between refreshes.
87 OGUSleep( 10000 );
88 OGLockSema( g_mFileTimeRequestMutex );
89
90 std::string currentfile = "";
91 do
92 {
93 {
94 std::unique_lock<std::mutex> ulm( g_mFileTimeCacheMapMutex );
95 std::map< std::string, bool >::iterator it;
96 if ( currentfile.length() == 0 )
97 it = g_mCheckFileSet.begin();
98 else
99 {
100 it = g_mCheckFileSet.find( currentfile );
101 it++;
102 }
103 if ( it == g_mCheckFileSet.end() ) break;
104 currentfile = it->first;
105 it->second = false;
106 }
107
108 double dTime = -1;
109 struct statstruct result;
110 if ( _stat( currentfile.c_str(), &result ) == 0 )
111 dTime = (double)result.st_mtime;
112
113 {
114 std::unique_lock<std::mutex> ulm( g_mFileTimeCacheMapMutex );
115 g_mFileTimeCacheMap[currentfile] = dTime;
116 }
117 } while ( 1 );
118 } while ( 1 );
119}
120
121double FileTimeCached( const char * fn )
122{

Callers

nothing calls this directly

Calls 7

OGUSleepFunction · 0.85
OGLockSemaFunction · 0.85
beginMethod · 0.80
findMethod · 0.80
endMethod · 0.80
_statClass · 0.50
lengthMethod · 0.45

Tested by

no test coverage detected