Changeset 4956 for geovis


Ignore:
Timestamp:
Jan 28, 2015 1:08:13 PM (5 years ago)
Author:
ldelgass
Message:

Delete cache dir from main() to allow renderer ref-counted objects to be
deleted and threads to exit first.

Location:
geovis/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • geovis/trunk/RenderServer.cpp

    r4635 r4956  
    2424
    2525#include "Trace.h"
     26#include "FileUtil.h"
    2627#include "ReadBuffer.h"
    2728#include "RenderServer.h"
     
    452453    g_inBufPtr = NULL;
    453454
     455    std::string cacheDir = g_renderer->getCacheDirectory();
    454456    TRACE("Deleting renderer");
    455457    delete g_renderer;
    456458    g_renderer = NULL;
     459    // Clean up cache directory after renderer's threads have finished
     460    removeDirectory(cacheDir.c_str());
    457461
    458462    TRACE("Exiting GeoVis Server");
  • geovis/trunk/Renderer.cpp

    r4955 r4956  
    117117    TRACE("Frame time target: %.2f msec", _minFrameTime * 1000.0f);
    118118
     119    setCacheBaseDirectory(CACHE_DIR);
    119120    char *base = getenv("MAP_BASE_URI");
    120121    if (base != NULL) {
     
    140141    TRACE("Enter");
    141142
    142     removeDirectory(_cacheDir.c_str());
     143    // Cache is deleted in main() to allow ref-counted objects to
     144    // be deleted and threads to exit first
    143145
    144146    TRACE("Leave");
     
    162164{
    163165    std::ostringstream dir;
    164     dir << CACHE_DIR << "/geovis_cache" << getpid();
     166    dir << _cacheBaseDir << "/geovis_cache" << getpid();
    165167    _cacheDir = dir.str();
    166168    const char *path = _cacheDir.c_str();
  • geovis/trunk/Renderer.h

    r4655 r4956  
    136136    }
    137137
     138    void setCacheBaseDirectory(const std::string& path)
     139    {
     140        TRACE("Set cache base dir to %s", path.c_str());
     141        _cacheBaseDir = path;
     142    }
     143
     144    std::string getCacheDirectory()
     145    {
     146        return _cacheDir;
     147    }
     148
    138149    std::string getBaseImage();
    139150
     
    490501
    491502    std::string _resourcePath;
     503    std::string _cacheBaseDir;
     504    std::string _cacheDir;
    492505    std::string _baseURI;
    493     std::string _cacheDir;
    494506
    495507    osg::ref_ptr<osg::Group> _sceneRoot;
Note: See TracChangeset for help on using the changeset viewer.