feisty meow concerns codebase  2.140
application Namespace Reference

Implements an application lock to ensure only one is running at once. More...

Classes

class  application_shell
 The application_shell is a base object for console programs. More...
 
class  base_application
 Provides a base object for the root application portion of a program. More...
 
class  command_parameter
 
class  command_line
 
class  hoople_service
 A platform-independent way to alert a program that it should shut down immediately. More...
 
class  launch_manager
 Provides methods for starting, stopping and checking on processes. More...
 
class  stdio_redirecter
 Redirects I/O for a newly launched application. More...
 
class  shared_memory
 Implements storage for memory that can be shared between threads. More...
 
class  singleton_application
 

Functions

bool it_is_a_prefix_char (char to_test)
 
window_handle create_simplistic_window (const basis::astring &formal(window_title), const basis::astring &formal(class_name))
 
void whack_simplistic_window (window_handle formal(f_window))
 

Variables

const int MAXIMUM_COMMAND_LINE = 32 * KILOBYTE
 
application_shellnot_so_hidden_pointer = NULL
 
 DEFINE_ARGC_AND_ARGV
 
int _global_argc
 
char ** _global_argv
 
const int CHECK_INTERVAL = 4 * SECOND_ms
 
const int GRACEFUL_SLACK = 90 * SECOND_ms
 
const int MAXIMUM_INITIAL_APP_WAIT = 4 * SECOND_ms
 
const int STARTUP_APPS_DELAY_PERIOD = 2 * SECOND_ms
 
const int MAXIMUM_REQUEST_PAUSE = 42 * SECOND_ms
 
const int IO_PAUSE_PERIOD = 50
 
const int BUFFER_SIZE = 4096
 
const char * REDIRECTER_INI = "redirecter.ini"
 
const char * PROCESS_SECTION = "process_id"
 
application_instance _i_handle
 < returns the name of the module for the "module_handle" where supported. More...
 

Detailed Description

Implements an application lock to ensure only one is running at once.

An add-in file providing window class registration and a window procedure.

This encapsulates the code used to ensure that only one copy of an application is running at a time. It can either be made specific to a user (so that user can run only one at a time) or made global to the entire machine.

This file makes it easier to add a very simple window to any console or win32 application that might need it (possibly because the app does not create any windows itself, but for crazy insane reasons, a window is still needed by an external agent, ahem installshield). It implements a very important part of this process, which is setting a window procedure and registering a window class. Sometime in 2005 or 2006, a windows update came through that made these formerly optional practices mandatory (and broke many of our applications that created windows without a window procedure or class registration). That occurrence prompted the creation of this class which tries to provide the bare minimum needed to make things work again.

Example Usage:

include our code file to embed the window procedure and register class methods in whoever needs them. this should only be needed once per program.

#include <application/windows_classist.h>

create our simple window...

basis::astring window_title = "my_freaky_window"; basis::astring class_name = "jumbo_stompy_update_crudburger";

window_handle f_window = create_simplistic_window(window_title, class_name);

and then much later, after the window is no longer needed...

whack_simplistic_window(f_window);

Function Documentation

◆ create_simplistic_window()

window_handle application::create_simplistic_window ( const basis::astring formalwindow_title,
const basis::astring formalclass_name 
)

Definition at line 62 of file window_classist.h.

References NULL_POINTER.

◆ it_is_a_prefix_char()

bool application::it_is_a_prefix_char ( char  to_test)

Definition at line 74 of file command_line.cpp.

◆ whack_simplistic_window()

void application::whack_simplistic_window ( window_handle   formalf_window)

Definition at line 64 of file window_classist.h.

Variable Documentation

◆ _global_argc

int application::_global_argc
extern

◆ _global_argv

◆ _i_handle

application_instance application::_i_handle
extern

< returns the name of the module for the "module_handle" where supported.

< if the handle is NULL_POINTER, then the program name is returned. < gets the most recent system error reported on this thread. < returns the OS's string form of the "error_to_show".

< this often comes from the value reported by system_error(). < returns the name of the system's NULL device.

< this device is a black hole where output can be sent, never to be seen again. this is /dev/null on unix and null: on win32. < returns a timeval system object that represents the "milliseconds".

< if "milliseconds" is zero, then the returned timeval will represent zero time passing (rather than infinite duration as some functions assume). dll_root.cpp defines this for all dlls.

◆ BUFFER_SIZE

const int application::BUFFER_SIZE = 4096

Definition at line 46 of file redirecter.cpp.

Referenced by application::stdio_redirecter::std_thread_action().

◆ CHECK_INTERVAL

const int application::CHECK_INTERVAL = 4 * SECOND_ms

Definition at line 52 of file launch_manager.cpp.

◆ DEFINE_ARGC_AND_ARGV

application::DEFINE_ARGC_AND_ARGV

Definition at line 40 of file command_line.cpp.

◆ GRACEFUL_SLACK

const int application::GRACEFUL_SLACK = 90 * SECOND_ms

◆ IO_PAUSE_PERIOD

const int application::IO_PAUSE_PERIOD = 50

Definition at line 44 of file redirecter.cpp.

◆ MAXIMUM_COMMAND_LINE

const int application::MAXIMUM_COMMAND_LINE = 32 * KILOBYTE

Definition at line 42 of file application_shell.cpp.

◆ MAXIMUM_INITIAL_APP_WAIT

const int application::MAXIMUM_INITIAL_APP_WAIT = 4 * SECOND_ms

Definition at line 60 of file launch_manager.cpp.

Referenced by application::launch_manager::launch_now().

◆ MAXIMUM_REQUEST_PAUSE

const int application::MAXIMUM_REQUEST_PAUSE = 42 * SECOND_ms

Definition at line 67 of file launch_manager.cpp.

◆ not_so_hidden_pointer

◆ PROCESS_SECTION

const char* application::PROCESS_SECTION = "process_id"

Definition at line 55 of file redirecter.cpp.

Referenced by application::stdio_redirecter::zap_program().

◆ REDIRECTER_INI

const char* application::REDIRECTER_INI = "redirecter.ini"

Definition at line 51 of file redirecter.cpp.

Referenced by application::stdio_redirecter::zap_program().

◆ STARTUP_APPS_DELAY_PERIOD

const int application::STARTUP_APPS_DELAY_PERIOD = 2 * SECOND_ms

Definition at line 64 of file launch_manager.cpp.