Renamed Synchronised::get()/set() to getAtomic()/setAtomic()

to better indicate what those functions are doing.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8611 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2011-05-16 21:49:58 +00:00
parent e0107c35eb
commit 8cd2eb1e16
6 changed files with 15 additions and 15 deletions

View File

@ -128,7 +128,7 @@ void AddonsManager::initOnline(const XMLNode *xml)
} // for i<xml->getNumNodes
delete xml;
m_state.set(STATE_READY);
m_state.setAtomic(STATE_READY);
downloadIcons();
} // initOnline
@ -177,7 +177,7 @@ void *AddonsManager::downloadIcons()
*/
bool AddonsManager::onlineReady()
{
return m_state.get()==STATE_READY;
return m_state.getAtomic()==STATE_READY;
} // onlineReady
// ----------------------------------------------------------------------------

View File

@ -59,7 +59,7 @@ public:
void initOnline(const XMLNode *xml);
bool onlineReady();
/** Marks addon as not being available. */
void setErrorState() { m_state.set(STATE_ERROR); }
void setErrorState() { m_state.setAtomic(STATE_ERROR); }
const Addon* getAddon(const std::string &id) const;
int getAddonIndex(const std::string &id) const;
bool install(const Addon &addon);

View File

@ -98,7 +98,7 @@ void NetworkHttp::startNetworkThread()
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
m_thread_id.set(new pthread_t());
m_thread_id.setAtomic(new pthread_t());
int error = pthread_create(m_thread_id.getData(), &attr,
&NetworkHttp::mainLoop, this);
if(error)
@ -106,7 +106,7 @@ void NetworkHttp::startNetworkThread()
m_thread_id.lock();
delete m_thread_id.getData();
m_thread_id.unlock();
m_thread_id.set(0);
m_thread_id.setAtomic(0);
printf("[addons] Warning: could not create thread, error=%d.\n", errno);
}
pthread_attr_destroy(&attr);
@ -426,7 +426,7 @@ void NetworkHttp::cancelAllDownloads()
{
if(UserConfigParams::logAddons())
printf("[addons] Requesting cancellation of download.\n");
m_abort.set(true);
m_abort.setAtomic(true);
} // cancelAllDownload
// ----------------------------------------------------------------------------
@ -495,15 +495,15 @@ int NetworkHttp::progressDownload(void *clientp,
Request *request = (Request *)clientp;
// Check if we are asked to abort the download. If so, signal this
// back to libcurl by returning a non-zero status.
if(network_http->m_abort.get() || request->isCancelled() )
if(network_http->m_abort.getAtomic() || request->isCancelled() )
{
if(UserConfigParams::logAddons())
{
if(network_http->m_abort.get())
if(network_http->m_abort.getAtomic())
{
// Reset abort flag so that the next download will work
// as expected.
network_http->m_abort.set(false);
network_http->m_abort.setAtomic(false);
printf("[addons] Global abort of downloads.\n");
}
else

View File

@ -31,7 +31,7 @@ Request::Request(HttpCommands command, int priority, bool manage_memory)
m_manage_memory = manage_memory;
m_icon_addon = NULL;
m_cancel = false;
m_progress.set(0);
m_progress.setAtomic(0);
} // Request
// ----------------------------------------------------------------------------
@ -46,7 +46,7 @@ Request::Request(HttpCommands command, int priority, bool manage_memory,
m_icon_addon = NULL;
m_manage_memory = manage_memory;
m_cancel = false;
m_progress.set(0);
m_progress.setAtomic(0);
} // Request
// ----------------------------------------------------------------------------

View File

@ -89,10 +89,10 @@ public:
int getPriority() const { return m_priority; }
// --------------------------------------------------------------------
/** Returns the current progress. */
float getProgress() const { return m_progress.get(); }
float getProgress() const { return m_progress.getAtomic(); }
// --------------------------------------------------------------------
/** Sets the current progress. */
void setProgress(float f) { m_progress.set(f); }
void setProgress(float f) { m_progress.setAtomic(f); }
// --------------------------------------------------------------------
/** Used in sorting requests by priority. */
bool operator<(const Request &r) { return r.m_priority < m_priority;}

View File

@ -53,7 +53,7 @@ public:
/** Sets the value of this variable using a mutex.
* \param v Value to be set.
*/
void set(const TYPE &v)
void setAtomic(const TYPE &v)
{
pthread_mutex_lock(&m_mutex);
m_data = v;
@ -63,7 +63,7 @@ public:
// ------------------------------------------------------------------------
/** Returns a copy of this variable.
*/
TYPE get() const
TYPE getAtomic() const
{
TYPE v;
pthread_mutex_lock(&m_mutex);