common.session_lock#

Module defines the classes and methods needed to set and edit session lock files.

The app has two session modes. When common.active_mode is common.SynchronisedActivePaths, the app will save active paths in the user settings file. However, when multiple app instances are running, this poses a problem, because instances will mutually overwrite each other’s active paths.

Hence, when a second app instance is launched common.active_mode is automatically set to common.PrivateActivePaths. When this mode is active, the initial active path values are read from the user settings, but active paths changes won’t be saved to the settings file.

To toggle between the two modes use bookmarks.actions.toggle_active_mode(). Also see bookmarks.statusbar.ToggleSessionModeButton.

Functions:

get_lock_path()

Returns the path to the current session's lock file.

init_lock()

Initialises the Bookmark's session lock.

prune_lock()

Removes stale lock files not associated with running PIDs.

remove_lock()

Removes the session lock file.

write_current_mode_to_lock(*args, **kwargs)

Write this session's current mode to the lock file.

bookmarks.common.session_lock.get_lock_path()[source]#

Returns the path to the current session’s lock file.

bookmarks.common.session_lock.init_lock()[source]#

Initialises the Bookmark’s session lock.

We’ll check all lock-files and to see if there’s already a SynchronisedActivePaths session. As we want only one session controlling the active path settings we’ll set all subsequent application sessions to be PrivateActivePaths (when PrivateActivePaths is on, all active path settings will be kept in memory, instead of writing them out to the disk).

bookmarks.common.session_lock.prune_lock()[source]#

Removes stale lock files not associated with running PIDs.

bookmarks.common.session_lock.remove_lock()[source]#

Removes the session lock file.

bookmarks.common.session_lock.write_current_mode_to_lock(*args, **kwargs)[source]#

Write this session’s current mode to the lock file.