Menu

#5 Add mutexes for Boxi under Win32

open
nobody
None
5
2010-03-25
2010-03-25
No

Creating mutexes for the Win32 client apps (bbackupctl.exe, bbackupd.exe, bbackupquery.exe) enable the detection of running instance during install/uninstall/upgrade. The fixes are trivial and platform-specific, sorry for that:

in main.cc

#include <wx/snglinst.h>

bool BoxiApp::OnInit()
{
// Initialise global SSL system configuration/state
SSLLib::Initialise();

// added to enable detection of running instances
const wxString mutex_name = wxT("__boxbackup_mutex__");
wxSingleInstanceChecker * m_pSingleInstanceChecker;
m_pSingleInstanceChecker = new wxSingleInstanceChecker(mutex_name);

even though the name wxSingleInstanceChecker might indicate otherwise, this only creates the Mutex under Win32, and does NOT prevent running multiple copies of Boxi.exe on the same machine at the same time. Check also http://docs.wxwidgets.org/stable/wx_wxsingleinstancechecker.html for more information.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB