diff options
author | Sergey Bugaev <bugaevc@gmail.com> | 2019-08-25 18:55:56 +0300 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-08-26 11:31:14 +0200 |
commit | e1a6f8a27d772ad27507394aeb4a7db55d93467c (patch) | |
tree | a67bedeb5841d7deb4f2a9c5364719151eddab3b /Libraries/LibThread/Thread.h | |
parent | d5f34872031a90bb449c4c1f9b5080f25a842238 (diff) | |
download | serenity-e1a6f8a27d772ad27507394aeb4a7db55d93467c.zip |
LibThread: Introduce a new threading library
This library is meant to provide C++-style wrappers over lower
level APIs such as syscalls and pthread_* functions, as well as
utilities for easily running pieces of logic on different
threads.
Diffstat (limited to 'Libraries/LibThread/Thread.h')
-rw-r--r-- | Libraries/LibThread/Thread.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Libraries/LibThread/Thread.h b/Libraries/LibThread/Thread.h new file mode 100644 index 0000000000..d9562da10f --- /dev/null +++ b/Libraries/LibThread/Thread.h @@ -0,0 +1,23 @@ +#pragma once + +#include <AK/Function.h> +#include <LibCore/CObject.h> + +namespace LibThread { + +class Thread final : public CObject { + C_OBJECT(Thread); + +public: + explicit Thread(Function<int()> action); + virtual ~Thread(); + + void start(); + void quit(int code = 0); + +private: + Function<int()> m_action; + int m_tid { -1 }; +}; + +} |