- now the mess with threads has gone away

- we have a class BaseThread -- this is a base class -- we can inherit from it when
  creating a new thread
- others treads are correctly stopped (when signal comes) -- pthread_join
- we have a special thread only for signals



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@685 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2010-12-02 01:02:02 +00:00
parent 08e53919e2
commit 35efed9fef
52 changed files with 2464 additions and 1825 deletions

View File

@@ -24,12 +24,11 @@
#include "system.h"
#include "mounts.h"
#include "request.h"
#include "synchro.h"
#include "sessionmanager.h"
#include "notify.h"
#include "db/db.h"
#include "functions/functions.h"
#include "templates/templates.h"
#include "templatesnotify/templatesnotify.h"
#include "compress.h"
#include "htmlfilter.h"
#include "getparser.h"
@@ -41,7 +40,6 @@
class App
{
public:
@@ -55,7 +53,12 @@ public:
void Close();
void LogUserGroups();
bool Demonize();
void WasStopSignal();
void SetStopSignal();
bool WasStopSignal();
bool Lock();
void Unlock();
void StartThreads();
void WaitForThreads();
// configuration read from a config file
Config config;
@@ -66,9 +69,6 @@ public:
// users sessions
SessionManager session_manager;
// notifications (by emails)
Notify notify;
// database
Db db;
DbConn db_conn;
@@ -103,7 +103,6 @@ public:
*/
Templates templates;
TemplatesNotify templates_notify;
private:
@@ -123,16 +122,18 @@ private:
Compress compress;
HTMLFilter html_filter;
std::wstring clean_html, html_with_debug;
volatile bool was_stop_signal;
FCGX_Request fcgi_request;
int fcgi_socket;
Synchro synchro;
pthread_t signal_thread;
std::string url_to_fetch_on_exit;
void ProcessRequestThrow();
void ProcessRequest();
bool BaseUrlRedirect();
void MakePage();
void Make();
void SaveSessionsIfNeeded(); // !! wywalic do managara sesji??
void SaveSessionsIfNeeded(); // !! wywalic do menagera sesji??
void LogAccess();
void ReadRequest();
@@ -162,6 +163,9 @@ private:
void LogGroups();
bool DropPrivileges(const std::string & user, uid_t uid, gid_t gid, bool additional_groups);
static void * SpecialThreadForSignals(void*);
void FetchPageOnExit();
// !! dodac do session managera?
time_t last_sessions_save;
};