MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / flush

Method flush

Engine/MemoryFile.cpp:381–414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

379}
380
381bool
382MemoryFile::flush(FlushTypeEnum type, void* data, std::size_t size)
383{
384 void* ptr = data ? data : _imp->data;
385 std::size_t n = data ? size : _imp->size;
386#if defined(__NATRON_UNIX__)
387 switch (type) {
388 case eFlushTypeAsync:
389 return ::msync(ptr, n, MS_ASYNC) == 0;
390 case eFlushTypeSync:
391 return ::msync(ptr, n, MS_SYNC) == 0;
392 case eFlushTypeInvalidate:
393 return ::msync(ptr, n, MS_INVALIDATE) == 0;
394 default:
395 break;
396 }
397#elif defined(__NATRON_WIN32__)
398 switch (type) {
399 case eFlushTypeSync: {
400 bool ret = (bool)::FlushViewOfFile(ptr, n) != 0;
401 if (ret) {
402 ret = (bool)::FlushFileBuffers(_imp->file_handle);
403 }
404 return ret;
405 } break;
406 case eFlushTypeAsync:
407 return (bool)::FlushViewOfFile(ptr, n) != 0;
408 case eFlushTypeInvalidate:
409 return true;
410 break;
411 }
412#endif
413 return false;
414}
415
416MemoryFile::~MemoryFile()
417{

Callers 10

onProcessCanceledMethod · 0.45
writeToOutputChannelMethod · 0.45
runMethod · 0.45
beginFunctionMethod · 0.45
printMethod · 0.45
endFunctionMethod · 0.45
deallocateMethod · 0.45
syncBackingFileMethod · 0.45
CacheClass · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected