Commit 80409986 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-16264: Fix some white space

parent 37f1ab23
......@@ -326,17 +326,11 @@ void dict_stats_deinit()
mutex_free(&recalc_pool_mutex);
}
/*****************************************************************//**
/**
Get the first table that has been added for auto recalc and eventually
update its stats.
@return : true if pool was non-empty and first entry does
not needs delay, false otherwise.
*/
static
bool
dict_stats_process_entry_from_recalc_pool()
/*=======================================*/
@return whether the first entry can be processed immediately */
static bool dict_stats_process_entry_from_recalc_pool()
{
table_id_t table_id;
......
......@@ -49,9 +49,6 @@ static tpool::task task(fts_optimize_callback,0, &task_group);
/** The FTS vector to store fts_slot_t */
static ib_vector_t* fts_slots;
/** Time to wait for a message. */
static const ulint FTS_QUEUE_WAIT_IN_USECS = 5000000;
/** Default optimize interval in secs. */
static const ulint FTS_OPTIMIZE_INTERVAL_IN_SECS = 300;
......
......@@ -663,8 +663,7 @@ Closes a file handle. In case of error, error number can be retrieved with
os_file_get_last_error.
@param[in] file own: handle to a file
@return true if success */
bool
os_file_close_func(os_file_t file);
bool os_file_close_func(os_file_t file);
#ifdef UNIV_PFS_IO
......
......@@ -78,7 +78,6 @@ Created 10/21/1995 Heikki Tuuri
#include <my_sys.h>
#endif
/* Per-IO operation environment*/
class io_slots
{
......@@ -281,59 +280,40 @@ os_win32_device_io_control(
/** Helper class for doing synchronous file IO. Currently, the objective
is to hide the OS specific code, so that the higher level functions aren't
peppered with #ifdef. Makes the code flow difficult to follow. */
class SyncFileIO {
class SyncFileIO
{
public:
/** Constructor
@param[in] fh File handle
@param[in,out] buf Buffer to read/write
@param[in] n Number of bytes to read/write
@param[in] offset Offset where to read or write */
SyncFileIO(os_file_t fh, void* buf, ulint n, os_offset_t offset)
:
m_fh(fh),
m_buf(buf),
m_n(static_cast<ssize_t>(n)),
m_offset(offset)
{
ut_ad(m_n > 0);
}
/** Destructor */
~SyncFileIO()
{
/* No op */
}
SyncFileIO(os_file_t fh, void *buf, ulint n, os_offset_t offset) :
m_fh(fh), m_buf(buf), m_n(static_cast<ssize_t>(n)), m_offset(offset)
{ ut_ad(m_n > 0); }
/** Do the read/write
@param[in] request The IO context and type
@return the number of bytes read/written or negative value on error */
ssize_t execute(const IORequest& request);
ssize_t execute(const IORequest &request);
/** Move the read/write offset up to where the partial IO succeeded.
@param[in] n_bytes The number of bytes to advance */
void advance(ssize_t n_bytes)
{
m_offset += n_bytes;
m_offset+= n_bytes;
ut_ad(m_n >= n_bytes);
m_n -= n_bytes;
m_buf = reinterpret_cast<uchar*>(m_buf) + n_bytes;
m_n-= n_bytes;
m_buf= reinterpret_cast<uchar*>(m_buf) + n_bytes;
}
private:
/** Open file handle */
os_file_t m_fh;
const os_file_t m_fh;
/** Buffer to read/write */
void* m_buf;
void *m_buf;
/** Number of bytes to read/write */
ssize_t m_n;
/** Offset from where to read/write */
os_offset_t m_offset;
};
......@@ -1665,19 +1645,15 @@ Closes a file handle. In case of error, error number can be retrieved with
os_file_get_last_error.
@param[in] file Handle to close
@return true if success */
bool
os_file_close_func(
os_file_t file)
bool os_file_close_func(os_file_t file)
{
int ret = close(file);
if (ret == -1) {
os_file_handle_error(NULL, "close");
int ret= close(file);
return(false);
}
if (!ret)
return true;
return(true);
os_file_handle_error(NULL, "close");
return false;
}
/** Gets a file size.
......@@ -2510,11 +2486,10 @@ os_file_create_func(
case SRV_O_DIRECT_NO_FSYNC:
case SRV_O_DIRECT:
if (type == OS_DATA_FILE) {
attributes |= FILE_FLAG_NO_BUFFERING;
}
if (type != OS_DATA_FILE) {
break;
}
/* fall through */
case SRV_ALL_O_DIRECT_FSYNC:
/*Traditional Windows behavior, no buffering for any files.*/
attributes |= FILE_FLAG_NO_BUFFERING;
......@@ -2849,22 +2824,18 @@ Closes a file handle. In case of error, error number can be retrieved with
os_file_get_last_error.
@param[in,own] file Handle to a file
@return true if success */
bool
os_file_close_func(
os_file_t file)
bool os_file_close_func(os_file_t file)
{
ut_a(file != 0);
if (!CloseHandle(file)) {
ut_ad(file);
if (!CloseHandle(file))
{
os_file_handle_error(NULL, "close");
return false;
}
if(srv_thread_pool)
srv_thread_pool->unbind(file);
return(true);
return true;
}
/** Gets a file size.
......
......@@ -31,7 +31,7 @@ namespace tpool
we use valid event handle for the hEvent member of the OVERLAPPED structure,
with its low-order bit set.
See MSDN docs for GetQueuedCompletionStatus() for description of this trick.
See MSDN docs for GetQueuedCompletionStatus() for description of this trick.
*/
static DWORD fls_sync_io= FLS_OUT_OF_INDEXES;
HANDLE win_get_syncio_event()
......
......@@ -53,7 +53,7 @@ namespace tpool
typedef void (*callback_func)(void *);
class task;
/* A class that can be used e.g for
/** A class that can be used e.g. for
restricting concurrency for specific class of tasks. */
class task_group
......
......@@ -162,26 +162,26 @@ class thread_pool_generic : public thread_pool
/** The task queue */
circular_queue<task*> m_task_queue;
/* List of standby (idle) workers.*/
/** List of standby (idle) workers */
doubly_linked_list<worker_data> m_standby_threads;
/** List of threads that are executing tasks. */
/** List of threads that are executing tasks */
doubly_linked_list<worker_data> m_active_threads;
/* Mutex that protects the whole struct, most importantly
the standby threads list, and task queue. */
the standby threads list, and task queue */
std::mutex m_mtx;
/** Timeout after which idle worker shuts down.*/
/** Timeout after which idle worker shuts down */
std::chrono::milliseconds m_thread_timeout;
/** How often should timer wakeup.*/
std::chrono::milliseconds m_timer_interval;
/** Another condition variable, used in pool shutdown-*/
/** Another condition variable, used in pool shutdown */
std::condition_variable m_cv_no_threads;
/** Condition variable for the timer thread. Signaled on shutdown.*/
/** Condition variable for the timer thread. Signaled on shutdown. */
std::condition_variable m_cv_timer;
/** Overall number of enqueues*/
......@@ -189,7 +189,7 @@ class thread_pool_generic : public thread_pool
/** Overall number of dequeued tasks. */
unsigned long long m_tasks_dequeued;
/**Statistic related, number of worker thread wakeups.*/
/** Statistic related, number of worker thread wakeups */
int m_wakeups;
/**
......@@ -198,7 +198,8 @@ class thread_pool_generic : public thread_pool
*/
int m_spurious_wakeups;
/** The desired concurrency. This number of workers should be actively executing.*/
/** The desired concurrency. This number of workers should be
actively executing. */
unsigned int m_concurrency;
/** True, if threadpool is being shutdown, false otherwise */
......@@ -387,9 +388,8 @@ void thread_pool_generic::cancel_pending(task* t)
/**
Register worker in standby list, and wait to be woken.
@return
true - thread was woken
false - idle wait timeout exceeded (the current thread need to shutdown)
@retval true if thread was woken
@retval false idle wait timeout exceeded (the current thread must shutdown)
*/
bool thread_pool_generic::wait_for_tasks(std::unique_lock<std::mutex> &lk,
worker_data *thread_data)
......
......@@ -199,44 +199,27 @@ template <typename T> class circular_queue
explicit iterator(size_t pos , circular_queue<T>* q) : m_pos(pos), m_queue(q) {}
iterator& operator++()
{
m_pos = (m_pos + 1) % m_queue->m_capacity;
m_pos= (m_pos + 1) % m_queue->m_capacity;
return *this;
}
iterator operator++(int)
{
iterator retval = *this;
++(*this);
iterator retval= *this;
++*this;
return retval;
}
bool operator==(iterator other) const
{
return m_pos == other.m_pos;
}
bool operator!=(iterator other) const
{
return !(*this == other);
}
T& operator*() const
{
return m_queue->m_buffer[m_pos];
}
bool operator==(iterator other) const { return m_pos == other.m_pos; }
bool operator!=(iterator other) const { return !(*this == other); }
T& operator*() const { return m_queue->m_buffer[m_pos]; }
};
iterator begin()
{
return iterator(m_tail, this);
}
iterator end()
{
return iterator(m_head, this);
}
iterator begin() { return iterator(m_tail, this); }
iterator end() { return iterator(m_head, this); }
private:
size_t m_capacity;
std::vector<T> m_buffer;
size_t m_head;
size_t m_tail;
};
/* Doubly linked list. Intrusive,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment