mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 11:27:39 +02:00
cleanup: os_thread_create -> std::thread
This commit is contained in:
parent
da3428805e
commit
dbe941e06f
10 changed files with 37 additions and 182 deletions
|
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, 2020, MariaDB Corporation.
|
||||
Copyright (c) 2017, 2021, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
|
|
@ -28,48 +28,15 @@ Created 9/8/1995 Heikki Tuuri
|
|||
#pragma once
|
||||
#include "univ.i"
|
||||
|
||||
/* Possible fixed priorities for threads */
|
||||
#define OS_THREAD_PRIORITY_NONE 100
|
||||
#define OS_THREAD_PRIORITY_BACKGROUND 1
|
||||
#define OS_THREAD_PRIORITY_NORMAL 2
|
||||
#define OS_THREAD_PRIORITY_ABOVE_NORMAL 3
|
||||
|
||||
#ifdef _WIN32
|
||||
typedef DWORD os_thread_t;
|
||||
typedef DWORD os_thread_id_t; /*!< In Windows the thread id
|
||||
is an unsigned long int */
|
||||
extern "C" {
|
||||
typedef LPTHREAD_START_ROUTINE os_thread_func_t;
|
||||
}
|
||||
|
||||
/** Macro for specifying a Windows thread start function. */
|
||||
#define DECLARE_THREAD(func) WINAPI func
|
||||
#else
|
||||
|
||||
typedef pthread_t os_thread_t;
|
||||
typedef pthread_t os_thread_id_t; /*!< In Unix we use the thread
|
||||
handle itself as the id of
|
||||
the thread */
|
||||
extern "C" { typedef void* (*os_thread_func_t)(void*); }
|
||||
|
||||
/** Macro for specifying a POSIX thread start function. */
|
||||
#define DECLARE_THREAD(func) func
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/* Define a function pointer type to use in a typecast */
|
||||
typedef void* (*os_posix_f_t) (void*);
|
||||
|
||||
#define os_thread_eq(a,b) IF_WIN(a == b, pthread_equal(a, b))
|
||||
#define os_thread_get_curr_id() IF_WIN(GetCurrentThreadId(), pthread_self())
|
||||
|
||||
/****************************************************************//**
|
||||
Creates a new thread of execution. The execution starts from
|
||||
the function given.
|
||||
NOTE: We count the number of threads in os_thread_exit(). A created
|
||||
thread should always use that to exit so thatthe thread count will be
|
||||
decremented.
|
||||
We do not return an error code because if there is one, we crash here. */
|
||||
os_thread_t os_thread_create(os_thread_func_t func, void *arg= nullptr);
|
||||
|
||||
/** Detach and terminate the current thread. */
|
||||
ATTRIBUTE_NORETURN void os_thread_exit();
|
||||
|
|
|
|||
|
|
@ -50,11 +50,8 @@ Rollback or clean up any incomplete transactions which were
|
|||
encountered in crash recovery. If the transaction already was
|
||||
committed, then we clean up a possible insert undo log. If the
|
||||
transaction was not yet committed, then we roll it back.
|
||||
Note: this is done in a background thread.
|
||||
@return a dummy parameter */
|
||||
extern "C"
|
||||
os_thread_ret_t
|
||||
DECLARE_THREAD(trx_rollback_all_recovered)(void*);
|
||||
Note: this is done in a background thread. */
|
||||
void trx_rollback_all_recovered(void*);
|
||||
/*********************************************************************//**
|
||||
Creates a rollback command node struct.
|
||||
@return own: rollback node struct */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue