diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-03-07 21:28:04 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-03-07 21:28:04 +0000 |
commit | 52e711ff6775a4b37aa6b13c9078ffb4906c7605 (patch) | |
tree | 24b99526d55089a8ac3e734d7d5742d13a2977f2 /fastos | |
parent | f0475a1393349d4c8e8245ee411b5cdbf500c54a (diff) |
GC unused threadpool.
Diffstat (limited to 'fastos')
-rw-r--r-- | fastos/src/vespa/fastos/app.cpp | 21 | ||||
-rw-r--r-- | fastos/src/vespa/fastos/app.h | 18 | ||||
-rw-r--r-- | fastos/src/vespa/fastos/file.cpp | 10 | ||||
-rw-r--r-- | fastos/src/vespa/fastos/file.h | 14 | ||||
-rw-r--r-- | fastos/src/vespa/fastos/linux_file.cpp | 7 | ||||
-rw-r--r-- | fastos/src/vespa/fastos/linux_file.h | 1 | ||||
-rw-r--r-- | fastos/src/vespa/fastos/unix_app.cpp | 25 | ||||
-rw-r--r-- | fastos/src/vespa/fastos/unix_app.h | 9 |
8 files changed, 14 insertions, 91 deletions
diff --git a/fastos/src/vespa/fastos/app.cpp b/fastos/src/vespa/fastos/app.cpp index 94e467d341d..05e885a7d37 100644 --- a/fastos/src/vespa/fastos/app.cpp +++ b/fastos/src/vespa/fastos/app.cpp @@ -12,13 +12,7 @@ #include <cstring> #include <fcntl.h> -FastOS_ThreadPool *FastOS_ApplicationInterface::GetThreadPool () -{ - return _threadPool; -} - FastOS_ApplicationInterface::FastOS_ApplicationInterface() : - _threadPool(nullptr), _argc(0), _argv(nullptr) { @@ -44,13 +38,10 @@ bool FastOS_ApplicationInterface::Init () if (PreThreadInit()) { if (FastOS_Thread::InitializeClass()) { - if (FastOS_File::InitializeClass()) { - _threadPool = new FastOS_ThreadPool(128 * 1024); - rc = true; - } else - fprintf(stderr, "FastOS_File class initialization failed.\n"); - } else + rc = true; + } else { fprintf(stderr, "FastOS_Thread class initialization failed.\n"); + } } else fprintf(stderr, "FastOS_PreThreadInit failed.\n"); @@ -60,12 +51,6 @@ bool FastOS_ApplicationInterface::Init () void FastOS_ApplicationInterface::Cleanup () { - if(_threadPool != nullptr) { - _threadPool->Close(); - delete _threadPool; - _threadPool = nullptr; - } - FastOS_File::CleanupClass(); FastOS_Thread::CleanupClass(); } diff --git a/fastos/src/vespa/fastos/app.h b/fastos/src/vespa/fastos/app.h index 6aa7a9346ed..c03dbc5848c 100644 --- a/fastos/src/vespa/fastos/app.h +++ b/fastos/src/vespa/fastos/app.h @@ -10,11 +10,7 @@ #pragma once -#include <vespa/fastos/types.h> - -class FastOS_ThreadPool; - -#include <mutex> +#include "types.h" /** * FastOS application wrapper class. @@ -125,14 +121,7 @@ class FastOS_ThreadPool; class FastOS_ApplicationInterface { friend int main (int argc, char **argv); - -private: - FastOS_ApplicationInterface(const FastOS_ApplicationInterface&); - FastOS_ApplicationInterface& operator=(const FastOS_ApplicationInterface&); - protected: - FastOS_ThreadPool *_threadPool; - virtual bool PreThreadInit () { return true; } public: @@ -140,7 +129,8 @@ public: char **_argv; FastOS_ApplicationInterface(); - + FastOS_ApplicationInterface(const FastOS_ApplicationInterface&) = delete; + FastOS_ApplicationInterface& operator=(const FastOS_ApplicationInterface&) = delete; virtual ~FastOS_ApplicationInterface(); /** @@ -182,8 +172,6 @@ public: * of @ref Init() and @ref Main(). */ virtual void Cleanup (); - - FastOS_ThreadPool *GetThreadPool (); }; diff --git a/fastos/src/vespa/fastos/file.cpp b/fastos/src/vespa/fastos/file.cpp index 4f585e7daeb..ca109d831a8 100644 --- a/fastos/src/vespa/fastos/file.cpp +++ b/fastos/src/vespa/fastos/file.cpp @@ -52,16 +52,6 @@ FastOS_FileInterface::FastOS_FileInterface(const char *filename) FastOS_FileInterface::~FastOS_FileInterface() = default; -bool FastOS_FileInterface::InitializeClass () -{ - return true; -} - -bool FastOS_FileInterface::CleanupClass () -{ - return true; -} - void FastOS_FileInterface::ReadBuf(void *buffer, size_t length) { diff --git a/fastos/src/vespa/fastos/file.h b/fastos/src/vespa/fastos/file.h index 238da364d54..b5e1add3529 100644 --- a/fastos/src/vespa/fastos/file.h +++ b/fastos/src/vespa/fastos/file.h @@ -99,20 +99,6 @@ public: void setFAdviseOptions(int options) { _fAdviseOptions = options; } /** - * Initialize the file class. This is invoked by - * @ref FastOS_Application::Init(). - * @return Boolean success/failure - */ - static bool InitializeClass (); - - /** - * Cleanup the file class. This is invoked by - * @ref FastOS_Application::Cleanup(). - * @return Boolean success/failure - */ - static bool CleanupClass (); - - /** * Copy a single file. Will overwrite destination if it already exists. * * @author Sveinar Rasmussen diff --git a/fastos/src/vespa/fastos/linux_file.cpp b/fastos/src/vespa/fastos/linux_file.cpp index 1074c02b4ac..6b58006eb62 100644 --- a/fastos/src/vespa/fastos/linux_file.cpp +++ b/fastos/src/vespa/fastos/linux_file.cpp @@ -413,13 +413,6 @@ FastOS_Linux_File::Open(unsigned int openFlags, const char *filename) return rc; } - -bool -FastOS_Linux_File::InitializeClass() -{ - return FastOS_UNIX_File::InitializeClass(); -} - int FastOS_Linux_File::count_open_files() { diff --git a/fastos/src/vespa/fastos/linux_file.h b/fastos/src/vespa/fastos/linux_file.h index f3c66d49f12..567af9e8ab0 100644 --- a/fastos/src/vespa/fastos/linux_file.h +++ b/fastos/src/vespa/fastos/linux_file.h @@ -40,7 +40,6 @@ public: [[nodiscard]] ssize_t Write2(const void *buffer, size_t len) override; bool Open(unsigned int openFlags, const char *filename) override; - static bool InitializeClass(); static size_t getMaxDirectIOMemAlign(); static int count_open_files(); private: diff --git a/fastos/src/vespa/fastos/unix_app.cpp b/fastos/src/vespa/fastos/unix_app.cpp index e94525fff22..6b1ff743506 100644 --- a/fastos/src/vespa/fastos/unix_app.cpp +++ b/fastos/src/vespa/fastos/unix_app.cpp @@ -23,9 +23,7 @@ extern char **environ; }; int -FastOS_UNIX_Application::GetOpt (const char *optionsString, - const char* &optionArgument, - int &optionIndex) +FastOS_UNIX_Application::GetOpt (const char *optionsString, const char* &optionArgument, int &optionIndex) { int rc = getopt(_argc, _argv, optionsString); optionArgument = optarg; @@ -34,16 +32,10 @@ FastOS_UNIX_Application::GetOpt (const char *optionsString, } int -FastOS_UNIX_Application::GetOptLong(const char *optionsString, - const char* &optionArgument, - int &optionIndex, - const struct option *longopts, - int *longindex) +FastOS_UNIX_Application::GetOptLong(const char *optionsString, const char* &optionArgument, int &optionIndex, + const struct option *longopts,int *longindex) { - int rc = getopt_long(_argc, _argv, optionsString, - longopts, - longindex); - + int rc = getopt_long(_argc, _argv, optionsString, longopts, longindex); optionArgument = optarg; optionIndex = optind; return rc; @@ -74,14 +66,7 @@ bool FastOS_UNIX_Application::PreThreadInit () bool FastOS_UNIX_Application::Init () { - bool rc = false; - - if(FastOS_ApplicationInterface::Init()) - { - rc = true; - } - - return rc; + return FastOS_ApplicationInterface::Init(); } void FastOS_UNIX_Application::Cleanup () diff --git a/fastos/src/vespa/fastos/unix_app.h b/fastos/src/vespa/fastos/unix_app.h index 5e076f4482b..beb494b4fea 100644 --- a/fastos/src/vespa/fastos/unix_app.h +++ b/fastos/src/vespa/fastos/unix_app.h @@ -8,9 +8,8 @@ #pragma once - -#include "types.h" #include "app.h" +#include "types.h" #include <memory> /** @@ -18,14 +17,12 @@ */ class FastOS_UNIX_Application : public FastOS_ApplicationInterface { -private: - FastOS_UNIX_Application(const FastOS_UNIX_Application&); - FastOS_UNIX_Application& operator=(const FastOS_UNIX_Application&); - protected: bool PreThreadInit () override; public: FastOS_UNIX_Application (); + FastOS_UNIX_Application(const FastOS_UNIX_Application&) = delete; + FastOS_UNIX_Application& operator=(const FastOS_UNIX_Application&) = delete; virtual ~FastOS_UNIX_Application(); /** |