diff options
| author | Paul Buetow <paul@buetow.org> | 2013-04-06 13:14:46 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2013-04-06 13:14:46 +0200 |
| commit | eab0b1c2d649fa16707b24cd2a91f195078167b0 (patch) | |
| tree | e960f351655305e3911089ff75677caef364a280 /src/stats.cpp | |
| parent | 07706f56cd421bf8b101a5c0fe44674d36e161a0 (diff) | |
tagging ychat-0.7.2ychat-0.7.2
Diffstat (limited to 'src/stats.cpp')
| -rw-r--r-- | src/stats.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/stats.cpp b/src/stats.cpp index 63757b6..7fba04d 100644 --- a/src/stats.cpp +++ b/src/stats.cpp @@ -11,14 +11,17 @@ stats::stats() i_rusage_vec_size = tool::string2int( wrap::CONF->get_elem("httpd.stats.rusagehistory")); + i_num_rooms = 0; //<< pthread_mutex_init( &mut_vec_rusage, NULL ); + pthread_mutex_init( &mut_num_rooms, NULL ); //<< } stats::~stats() { pthread_mutex_destroy( &mut_vec_rusage ); + pthread_mutex_destroy( &mut_num_rooms ); //<< } void @@ -99,4 +102,47 @@ stats::get_rusage_history( string s_type, string s_seperator ) return s_ret; } +//<<* +int +stats::get_num_rooms() +{ + pthread_mutex_lock ( &mut_num_rooms ); + int i_ret = i_num_rooms; + pthread_mutex_unlock( &mut_num_rooms ); + return i_ret; +} + +void +stats::increment_num_rooms() +{ + pthread_mutex_lock ( &mut_num_rooms ); + ++i_num_rooms; + pthread_mutex_unlock( &mut_num_rooms ); +#ifdef NCURSES + print_num_rooms(); +#endif +} +void +stats::decrement_num_rooms() +{ + pthread_mutex_lock ( &mut_num_rooms ); + --i_num_rooms; + pthread_mutex_unlock( &mut_num_rooms ); +#ifdef NCURSES + print_num_rooms(); +#endif +} + +#ifdef NCURSES +void +stats::print_num_rooms() +{ + if ( !wrap::NCUR->is_ready() ) + return; + + mvprintw( NCUR_NUM_ROOMS_X, NCUR_NUM_ROOMS_Y, "Rooms: %d", get_num_rooms()); + refresh(); +} +#endif +//*>> #endif |
