<commit_before>#pragma once

#include "volumeinfo.hpp"
#include "threading/cexecutionqueue.h"
#include "threading/cperiodicexecutionthread.h"

DISABLE_COMPILER_WARNINGS
#include <QTimer>
RESTORE_COMPILER_WARNINGS

#include <deque>

// Lists all the volumes available on a target machine
class CVolumeEnumerator : protected QObject
{
public:
	CVolumeEnumerator();

	// Volumes list observer interface
	class IVolumeListObserver
	{
	public:
		virtual ~IVolumeListObserver() = default;
		virtual void volumesChanged() = 0;
	};

	// Adds the observer
	void addObserver(IVolumeListObserver * observer);
	// Removes the observer
	void removeObserver(IVolumeListObserver * observer);
	// Returns the drives found
	const std::deque<VolumeInfo>& drives() const;

	// Forces an update in this thread
	void updateSynchronously();

private:
	// Refresh the list of available volumes
	void enumerateVolumes(bool async);

	// Calls all the registered observers with the latest list of drives found
	void notifyObservers(bool async) const;

	static const std::deque<VolumeInfo> enumerateVolumesImpl();

private:
	std::deque<VolumeInfo> _drives;
	std::deque<IVolumeListObserver*> _observers;
	mutable CExecutionQueue          _notificationsQueue;
	CPeriodicExecutionThread         _enumeratorThread;
	QTimer                           _timer;

	const unsigned int _updateInterval = 1000; // ms
};
<commit_msg>Incorrect CVolumeEnumerator thread update interval fixed (beware of the class member initialization order!)<commit_after>#pragma once

#include "volumeinfo.hpp"
#include "threading/cexecutionqueue.h"
#include "threading/cperiodicexecutionthread.h"

DISABLE_COMPILER_WARNINGS
#include <QTimer>
RESTORE_COMPILER_WARNINGS

#include <deque>

// Lists all the volumes available on a target machine
class CVolumeEnumerator : protected QObject
{
public:
	CVolumeEnumerator();

	// Volumes list observer interface
	class IVolumeListObserver
	{
	public:
		virtual ~IVolumeListObserver() = default;
		virtual void volumesChanged() = 0;
	};

	// Adds the observer
	void addObserver(IVolumeListObserver * observer);
	// Removes the observer
	void removeObserver(IVolumeListObserver * observer);
	// Returns the drives found
	const std::deque<VolumeInfo>& drives() const;

	// Forces an update in this thread
	void updateSynchronously();

private:
	// Refresh the list of available volumes
	void enumerateVolumes(bool async);

	// Calls all the registered observers with the latest list of drives found
	void notifyObservers(bool async) const;

	static const std::deque<VolumeInfo> enumerateVolumesImpl();

private:
	std::deque<VolumeInfo> _drives;
	std::deque<IVolumeListObserver*> _observers;
	mutable CExecutionQueue          _notificationsQueue;
	CPeriodicExecutionThread         _enumeratorThread;
	QTimer                           _timer;

	static const unsigned int _updateInterval = 1000; // ms
};

{'fraction_non_alphanumeric': 0.07651186100902105, 'fraction_numerical': 0.003341129301703976, 'mean_word_length': 3.892156862745098, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4890063', 'n_tokens_mistral': 927, 'n_tokens_neox': 872, 'n_words': 251}