put QSE_CPP_NOEXCEPT in some App methods
This commit is contained in:
parent
3376fb8fc4
commit
ee44b2953f
@ -113,15 +113,15 @@ public:
|
||||
|
||||
virtual void on_signal (int sig) { }
|
||||
|
||||
SignalState getSignalSubscription (int sig) const;
|
||||
int setSignalSubscription (int sig, SignalState ss, bool ignore_if_unhandled = false);
|
||||
SignalState getSignalSubscription (int sig) const QSE_CPP_NOEXCEPT;
|
||||
int setSignalSubscription (int sig, SignalState ss, bool ignore_if_unhandled = false) QSE_CPP_NOEXCEPT;
|
||||
|
||||
int acceptSignal (int sig)
|
||||
int acceptSignal (int sig) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
return this->setSignalSubscription(sig, SIGNAL_ACCEPTED);
|
||||
}
|
||||
|
||||
int discardSignal (int sig)
|
||||
int discardSignal (int sig) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
return this->setSignalSubscription(sig, SIGNAL_DISCARDED);
|
||||
}
|
||||
@ -132,14 +132,14 @@ public:
|
||||
// initialized, no signal handler is established for the given
|
||||
// signal. the ignore_if_unhandled is true, this function
|
||||
// sets up signal handle to ignore the handler instead.
|
||||
int neglectSignal (int sig, bool ignore_if_unhandled = false)
|
||||
int neglectSignal (int sig, bool ignore_if_unhandled = false) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
return this->setSignalSubscription(sig, SIGNAL_NEGLECTED, ignore_if_unhandled);
|
||||
}
|
||||
|
||||
int acceptSignals (const SignalSet& signals);
|
||||
int discardSignals (const SignalSet& signals);
|
||||
int neglectSignals (const SignalSet& signals, bool ignore_if_unhandled = false);
|
||||
int acceptSignals (const SignalSet& signals) QSE_CPP_NOEXCEPT;
|
||||
int discardSignals (const SignalSet& signals) QSE_CPP_NOEXCEPT;
|
||||
int neglectSignals (const SignalSet& signals, bool ignore_if_unhandled = false) QSE_CPP_NOEXCEPT;
|
||||
|
||||
|
||||
typedef void (*SignalHandler) (int sig);
|
||||
@ -151,49 +151,49 @@ public:
|
||||
// setSignalHandler() has been made without unsetSingalHandler() called
|
||||
// yet, a subsequent call to subscribeToSignal() is doomed to fail too.
|
||||
// These two different interfaces are mutually exclusive.
|
||||
static int setSignalHandler (int sig, SignalHandler sighr);
|
||||
static int unsetSignalHandler (int sig, bool ignore = false);
|
||||
static int setSignalHandler (int sig, SignalHandler sighr) QSE_CPP_NOEXCEPT;
|
||||
static int unsetSignalHandler (int sig, bool ignore = false) QSE_CPP_NOEXCEPT;
|
||||
|
||||
bool isGuardian () const
|
||||
bool isGuardian () const QSE_CPP_NOEXCEPT
|
||||
{
|
||||
return this->_guarded_child_pid >= 0;
|
||||
}
|
||||
|
||||
int guardProcess (const SignalSet& signals, bool _guard = true, qse_mtime_t guard_pause_ms = 0, const qse_mchar_t* proc_name = QSE_NULL);
|
||||
int guardProcess (const SignalSet& signals, bool _guard = true, qse_mtime_t guard_pause_ms = 0, const qse_mchar_t* proc_name = QSE_NULL) QSE_CPP_NOEXCEPT;
|
||||
|
||||
|
||||
// =============================================================
|
||||
// LOGGING SUPPORT
|
||||
// =============================================================
|
||||
void setSyslogFacility (qse_log_facility_t fac) /* useful for syslog is set as a target */
|
||||
void setSyslogFacility (qse_log_facility_t fac) QSE_CPP_NOEXCEPT /* useful for syslog is set as a target */
|
||||
{
|
||||
qse_log_setsyslogfacility (&this->_log.logger, fac);
|
||||
}
|
||||
|
||||
void setLogPriorityMask (int pri_mask) { this->_log.pri_mask = pri_mask; }
|
||||
int getLogPriorityMask () const { return this->_log.pri_mask; }
|
||||
void setLogPriorityMask (int pri_mask) QSE_CPP_NOEXCEPT { this->_log.pri_mask = pri_mask; }
|
||||
int getLogPriorityMask () const QSE_CPP_NOEXCEPT { return this->_log.pri_mask; }
|
||||
|
||||
void setLogOption (int option_flags) /* 0 or bitwise-OR'ed of qse_log_option_flag_t bits */
|
||||
void setLogOption (int option_flags) QSE_CPP_NOEXCEPT /* 0 or bitwise-OR'ed of qse_log_option_flag_t bits */
|
||||
{
|
||||
qse_log_setoption (&this->_log.logger, option_flags);
|
||||
}
|
||||
|
||||
int getLogOption () const
|
||||
int getLogOption () const QSE_CPP_NOEXCEPT
|
||||
{
|
||||
return qse_log_getoption(&this->_log.logger);
|
||||
}
|
||||
|
||||
void setLogTarget (int target_flags, const qse_log_target_data_t& target)
|
||||
void setLogTarget (int target_flags, const qse_log_target_data_t& target) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
qse_log_settarget (&this->_log.logger, target_flags, &target);
|
||||
}
|
||||
|
||||
int getLogTarget (qse_log_target_data_t& target) const
|
||||
int getLogTarget (qse_log_target_data_t& target) const QSE_CPP_NOEXCEPT
|
||||
{
|
||||
return qse_log_gettarget(&this->_log.logger, &target);
|
||||
}
|
||||
|
||||
void logfmt (qse_log_priority_flag_t pri, const qse_char_t* fmt, ...)
|
||||
void logfmt (qse_log_priority_flag_t pri, const qse_char_t* fmt, ...) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
va_list ap;
|
||||
va_start (ap, fmt);
|
||||
@ -201,11 +201,11 @@ public:
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
void logfmtv (qse_log_priority_flag_t pri, const qse_char_t* fmt, va_list ap);
|
||||
void logfmtv (qse_log_priority_flag_t pri, const qse_char_t* fmt, va_list ap) QSE_CPP_NOEXCEPT;
|
||||
|
||||
protected:
|
||||
// subclasses may override this if the defaulg logging output is not desired.
|
||||
virtual void log_write (qse_log_priority_flag_t mask, const qse_char_t* msg, qse_size_t len);
|
||||
virtual void log_write (qse_log_priority_flag_t mask, const qse_char_t* msg, qse_size_t len) QSE_CPP_NOEXCEPT;
|
||||
|
||||
private:
|
||||
App* _prev_app;
|
||||
@ -237,14 +237,14 @@ private:
|
||||
mutable qse_log_t logger;
|
||||
} _log;
|
||||
|
||||
static int set_signal_handler_no_mutex (int sig, SignalHandler sighr);
|
||||
static int unset_signal_handler_no_mutex (int sig, int ignore);
|
||||
int set_signal_subscription_no_mutex (int sig, SignalState reqstate, bool ignore_if_unhandled);
|
||||
static int set_signal_handler_no_mutex (int sig, SignalHandler sighr) QSE_CPP_NOEXCEPT;
|
||||
static int unset_signal_handler_no_mutex (int sig, int ignore) QSE_CPP_NOEXCEPT;
|
||||
int set_signal_subscription_no_mutex (int sig, SignalState reqstate, bool ignore_if_unhandled) QSE_CPP_NOEXCEPT;
|
||||
|
||||
void on_guard_signal (int sig);
|
||||
static void handle_signal (int sig);
|
||||
void on_guard_signal (int sig) QSE_CPP_NOEXCEPT;
|
||||
static void handle_signal (int sig) QSE_CPP_NOEXCEPT;
|
||||
|
||||
static int put_char_to_log_buf (qse_char_t c, void* ctx);
|
||||
static int put_char_to_log_buf (qse_char_t c, void* ctx) QSE_CPP_NOEXCEPT;
|
||||
};
|
||||
|
||||
/////////////////////////////////
|
||||
|
@ -151,8 +151,16 @@ public:
|
||||
// for example, you call getIfceAddress() followed by getIfceNetmask().
|
||||
// the network configuration information may change in between.
|
||||
// the address/netmask pair may not be the valid fixed combination.
|
||||
int getIfceAddress (const qse_mchar_t* name, SocketAddress* addr) QSE_CPP_NOEXCEPT;
|
||||
int getIfceAddress (const qse_wchar_t* name, SocketAddress* addr) QSE_CPP_NOEXCEPT;
|
||||
int getIfceAddress (const qse_mchar_t* name, SocketAddress* addr, int family) QSE_CPP_NOEXCEPT;
|
||||
int getIfceAddress (const qse_wchar_t* name, SocketAddress* addr, int family) QSE_CPP_NOEXCEPT;
|
||||
int getIfceAddress (const qse_mchar_t* name, SocketAddress* addr) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
return this->getIfceAddress(name, addr, this->domain);
|
||||
}
|
||||
int getIfceAddress (const qse_wchar_t* name, SocketAddress* addr) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
return this->getIfceAddress(name, addr, this->domain);
|
||||
}
|
||||
int getIfceNetmask (const qse_mchar_t* name, SocketAddress* addr) QSE_CPP_NOEXCEPT;
|
||||
int getIfceNetmask (const qse_wchar_t* name, SocketAddress* addr) QSE_CPP_NOEXCEPT;
|
||||
int getIfceBroadcast (const qse_mchar_t* name, SocketAddress* addr) QSE_CPP_NOEXCEPT;
|
||||
|
@ -54,7 +54,7 @@ static struct app_sig_t
|
||||
class SigScopedMutexLocker
|
||||
{
|
||||
public:
|
||||
SigScopedMutexLocker (Mutex& mutex): mutex(mutex)
|
||||
SigScopedMutexLocker (Mutex& mutex) QSE_CPP_NOEXCEPT: mutex(mutex)
|
||||
{
|
||||
sigset_t sigset;
|
||||
sigfillset (&sigset);
|
||||
@ -64,7 +64,7 @@ public:
|
||||
this->mutex.lock ();
|
||||
}
|
||||
|
||||
~SigScopedMutexLocker ()
|
||||
~SigScopedMutexLocker () QSE_CPP_NOEXCEPT
|
||||
{
|
||||
this->mutex.unlock ();
|
||||
::sigprocmask (SIG_SETMASK, &this->oldsigset, QSE_NULL);
|
||||
@ -263,13 +263,13 @@ static void dispatch_siginfo (int sig, siginfo_t* si, void* ctx)
|
||||
}
|
||||
}
|
||||
|
||||
int App::setSignalHandler (int sig, SignalHandler sighr)
|
||||
int App::setSignalHandler (int sig, SignalHandler sighr) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
SigScopedMutexLocker sml(g_app_mutex);
|
||||
return App::set_signal_handler_no_mutex (sig, sighr);
|
||||
}
|
||||
|
||||
int App::set_signal_handler_no_mutex (int sig, SignalHandler sighr)
|
||||
int App::set_signal_handler_no_mutex (int sig, SignalHandler sighr) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
if (App::_sighrs[0][sig]) return -1; // already set
|
||||
|
||||
@ -305,13 +305,13 @@ int App::set_signal_handler_no_mutex (int sig, SignalHandler sighr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int App::unsetSignalHandler (int sig, bool ignore)
|
||||
int App::unsetSignalHandler (int sig, bool ignore) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
SigScopedMutexLocker sml(g_app_mutex);
|
||||
return App::unset_signal_handler_no_mutex(sig, ignore);
|
||||
}
|
||||
|
||||
int App::unset_signal_handler_no_mutex(int sig, int ignore)
|
||||
int App::unset_signal_handler_no_mutex(int sig, int ignore) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
if (!App::_sighrs[0][sig]) return -1;
|
||||
|
||||
@ -341,7 +341,7 @@ int App::unset_signal_handler_no_mutex(int sig, int ignore)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*static*/ void App::handle_signal (int sig)
|
||||
/*static*/ void App::handle_signal (int sig) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
// Note: i use ScopedMutexLocker in the signal handler
|
||||
// whereas I use SigScopedMutexLocker in other functions.
|
||||
@ -367,25 +367,25 @@ int App::unset_signal_handler_no_mutex(int sig, int ignore)
|
||||
}
|
||||
}
|
||||
|
||||
void App::on_guard_signal (int sig)
|
||||
void App::on_guard_signal (int sig) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
::kill (this->_guarded_child_pid, sig);
|
||||
}
|
||||
|
||||
App::SignalState App::getSignalSubscription (int sig) const
|
||||
App::SignalState App::getSignalSubscription (int sig) const QSE_CPP_NOEXCEPT
|
||||
{
|
||||
QSE_ASSERT (sig >= 0 && sig < QSE_NSIGS);
|
||||
return this->_sig[sig]._state;
|
||||
}
|
||||
|
||||
int App::setSignalSubscription (int sig, SignalState ss, bool ignore_if_unhandled)
|
||||
int App::setSignalSubscription (int sig, SignalState ss, bool ignore_if_unhandled) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
QSE_ASSERT (sig >= 0 && sig < QSE_NSIGS);
|
||||
SigScopedMutexLocker sml(g_app_mutex);
|
||||
return this->set_signal_subscription_no_mutex(sig, ss, ignore_if_unhandled);
|
||||
}
|
||||
|
||||
int App::set_signal_subscription_no_mutex (int sig, SignalState reqstate, bool ignore_if_unhandled)
|
||||
int App::set_signal_subscription_no_mutex (int sig, SignalState reqstate, bool ignore_if_unhandled) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
_SigLink& sl = this->_sig[sig];
|
||||
|
||||
@ -458,7 +458,7 @@ int App::set_signal_subscription_no_mutex (int sig, SignalState reqstate, bool i
|
||||
return reqstate;
|
||||
}
|
||||
|
||||
int App::acceptSignals (const SignalSet& signals)
|
||||
int App::acceptSignals (const SignalSet& signals) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
int n = 0;
|
||||
|
||||
@ -473,7 +473,7 @@ int App::acceptSignals (const SignalSet& signals)
|
||||
return n;
|
||||
}
|
||||
|
||||
int App::discardSignals (const SignalSet& signals)
|
||||
int App::discardSignals (const SignalSet& signals) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
int n = 0;
|
||||
|
||||
@ -488,7 +488,7 @@ int App::discardSignals (const SignalSet& signals)
|
||||
return n;
|
||||
}
|
||||
|
||||
int App::neglectSignals (const SignalSet& signals, bool ignore_if_unhandled)
|
||||
int App::neglectSignals (const SignalSet& signals, bool ignore_if_unhandled) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
int n = 0;
|
||||
|
||||
@ -503,7 +503,7 @@ int App::neglectSignals (const SignalSet& signals, bool ignore_if_unhandled)
|
||||
return n;
|
||||
}
|
||||
|
||||
int App::guardProcess (const SignalSet& signals, bool _guard, qse_mtime_t guard_pause_ms, const qse_mchar_t* proc_name)
|
||||
int App::guardProcess (const SignalSet& signals, bool _guard, qse_mtime_t guard_pause_ms, const qse_mchar_t* proc_name) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
SignalState old_ss[QSE_NSIGS];
|
||||
int seq = 0;
|
||||
@ -588,7 +588,7 @@ int App::guardProcess (const SignalSet& signals, bool _guard, qse_mtime_t guard_
|
||||
}
|
||||
|
||||
|
||||
int App::put_char_to_log_buf (qse_char_t c, void* ctx)
|
||||
int App::put_char_to_log_buf (qse_char_t c, void* ctx) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
App* app = (App*)ctx;
|
||||
|
||||
@ -626,7 +626,7 @@ static int mbs_to_wcs (const qse_mchar_t* mbs, qse_size_t* mbslen, qse_wchar_t*
|
||||
return qse_mbsntowcsnwithcmgr(mbs, mbslen, wcs, wcslen, app->getCmgr());
|
||||
}
|
||||
|
||||
void App::logfmtv (qse_log_priority_flag_t pri, const qse_char_t* fmt, va_list ap)
|
||||
void App::logfmtv (qse_log_priority_flag_t pri, const qse_char_t* fmt, va_list ap) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
/*if (this->threaded)*/ this->_log.mtx.lock ();
|
||||
|
||||
@ -660,7 +660,7 @@ void App::logfmtv (qse_log_priority_flag_t pri, const qse_char_t* fmt, va_list a
|
||||
}
|
||||
|
||||
// default log message output implementation
|
||||
void App::log_write (qse_log_priority_flag_t pri, const qse_char_t* msg, qse_size_t len)
|
||||
void App::log_write (qse_log_priority_flag_t pri, const qse_char_t* msg, qse_size_t len) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
// the last character is \n. qse_log_report() knows to terminate a line. so exclude it from reporting
|
||||
qse_log_report (&this->_log.logger, QSE_NULL, pri, QSE_T("%.*js"), (int)(len - 1), msg);
|
||||
|
@ -1245,7 +1245,8 @@ int Socket::get_ifce_address (int cmd, const void* name, qse_size_t len, bool wc
|
||||
if (!sa || !sa->sa_data) continue;
|
||||
if (sa->sa_family != this->domain) continue; /* skip an address that doesn't match the socket's domain */
|
||||
|
||||
*addr = SocketAddress((const qse_skad_t*)sa);
|
||||
//*addr = SocketAddress((const qse_skad_t*)sa);
|
||||
addr->set ((const qse_skad_t*)sa);
|
||||
freeifaddrs (ifa);
|
||||
return 0;
|
||||
}
|
||||
@ -1267,7 +1268,8 @@ int Socket::get_ifce_address (int cmd, const void* name, qse_size_t len, bool wc
|
||||
return -1;
|
||||
}
|
||||
|
||||
*addr = SocketAddress((const qse_skad_t*)&ifr.ifr_addr);
|
||||
//*addr = SocketAddress((const qse_skad_t*)&ifr.ifr_addr);
|
||||
addr->set ((const qse_skad_t*)&ifr.ifr_addr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user