Logo Search packages:      
Sourcecode: gaia version File versions  Download package

void SimpleTileStorage::ThreadRun (  )  [private]

Thread function.

This function loops endlessly taking tiles from queue one by one and processig them with Process()

Definition at line 76 of file SimpleTileStorage.cc.

References TileStorage::Enqueue(), m_pNextLoadStorage, m_pSaveStorage, m_Queue, m_QueueEmptyCond, m_QueueMutex, and Process().

Referenced by ThreadEntryPoint().

      /* spin in this loop forever */
      while(1) {
            while (m_Queue.size() == 0)
                  pthread_cond_wait(&m_QueueEmptyCond, &m_QueueMutex);

            TilePtr current = m_Queue.front();


            if (!current->IsOld()) {
                  try {
                        try {
                              /* do actual processing - defined in derived class */
                        } catch (std::exception &e) {
                              /* storage error worth to be reported to user, like:
                               * - unable to download from web due to `cannot connect' or `authentication failed'
                               * - unable to save
                              warning("SimpleTileStorage: error (%s) (%d %d %d)\n", e.what(), current->GetX(), current->GetY(), current->GetLevel());

                              /* XXX: this may need to be added to avoid loops
                               * (but there will be no loops in basic storage layout with 1 local and 1 remote storages)
                              if (current->IsSaveable)

                        /* pass it down the chain */
                        if (current->IsLoaded() && current->IsSaveable() && m_pSaveStorage)
                        else if (!current->IsLoaded() && m_pNextLoadStorage)
                  } catch (std::exception &e) {
                        /* fatal error in enqueue?! */
                        warning("SimpleTileStorage: fatal error (%s) (%d %d %d)\n", e.what(), current->GetX(), current->GetY(), current->GetLevel());

Generated by  Doxygen 1.6.0   Back to index