Decent killing of the network singleton and thread.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/uni@13294 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
ebc3696de1
commit
ac40b8111b
@ -169,6 +169,7 @@
|
||||
#include "modes/demo_world.hpp"
|
||||
#include "modes/profile_world.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
#include "online/http_manager.hpp"
|
||||
#include "race/grand_prix_manager.hpp"
|
||||
#include "race/highscore_manager.hpp"
|
||||
#include "race/history.hpp"
|
||||
@ -1211,6 +1212,8 @@ void cleanSuperTuxKart()
|
||||
|
||||
if(INetworkHttp::get())
|
||||
INetworkHttp::get()->stopNetworkThread();
|
||||
if(Online::HTTPManager::isRunning())
|
||||
Online::HTTPManager::get()->stopNetworkThread();
|
||||
//delete in reverse order of what they were created in.
|
||||
//see InitTuxkart()
|
||||
Referee::cleanup();
|
||||
|
@ -59,6 +59,11 @@ namespace Online{
|
||||
http_singleton = NULL;
|
||||
} // deallocate
|
||||
|
||||
bool HTTPManager::isRunning()
|
||||
{
|
||||
return http_singleton != NULL;
|
||||
}
|
||||
|
||||
|
||||
HTTPManager::HTTPManager(){
|
||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
|
@ -45,7 +45,7 @@ namespace Online{
|
||||
protected:
|
||||
|
||||
/** The current requested being worked on. */
|
||||
Online::Request *m_current_request;
|
||||
Online::Request * m_current_request;
|
||||
|
||||
/** A conditional variable to wake up the main loop. */
|
||||
pthread_cond_t m_cond_request;
|
||||
@ -66,8 +66,6 @@ namespace Online{
|
||||
|
||||
static void *mainLoop(void *obj);
|
||||
void startNetworkThread();
|
||||
void stopNetworkThread();
|
||||
|
||||
|
||||
HTTPManager(); //const std::string &url
|
||||
~HTTPManager();
|
||||
@ -77,6 +75,7 @@ namespace Online{
|
||||
// singleton
|
||||
static HTTPManager* get();
|
||||
static void deallocate();
|
||||
static bool isRunning();
|
||||
|
||||
//Execute
|
||||
std::string getPage(Online::Request * request);
|
||||
@ -84,6 +83,7 @@ namespace Online{
|
||||
|
||||
void addRequest(Online::Request *request);
|
||||
void cancelAllDownloads();
|
||||
void stopNetworkThread();
|
||||
|
||||
bool getAbort(){ return m_abort.getAtomic(); };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user