summaryrefslogtreecommitdiff
path: root/Libraries/LibThread
AgeCommit message (Collapse)Author
2020-08-17LibThread: Uninitialized member variable in Thread, found by CoverityBrian Gianforcaro
2020-08-14LibThread: Lockable - add forwarding constructorMuhammad Zahalqa
2020-08-10Kernel: More PID/TID typingBen Wiederhake
2020-08-07LibThread: Remove redundant --m_level in Lock::unlock() (#3040)Muhammad Zahalqa
2020-08-06LibThread: Remove redundant r/w of atomic variable in Lock::lock() (#3013)Muhammad Zahalqa
m_holder.compare_exchange_strong(expected, desired, ...) will either successfully update the value to desired if == expected or put the current value in expected otherwise.
2020-07-21LibPThread: Make pthread_exit a noreturn functionMuhammad Zahalqa
LibPThread: mark pthread_exit a noreturn function using compiler attributes LibThread: remove a call to pthread_exit from Thread::start lambda expression as it make the return of teh lambda unreachable.
2020-05-14Build: Switch to CMake :^)Sergey Bugaev
Closes https://github.com/SerenityOS/serenity/issues/2080
2020-04-30AK: Add ALWAYS_INLINE, NEVER_INLINE and FLATTEN macrosAndreas Kling
It's tedious to write (and look at) [[gnu::always_inline]] etc. :^)
2020-04-13LibThread: Simplify the userspace Lock to remove CAS on unlock()Andreas Kling
Instead of using a separate synchronization variable, just use the lock holder TID for synchronization. This way, we only need to CAS when first acquiring a lock.
2020-02-25LibThread: Fix destroying background actionsSergey Bugaev
In the old model, before bc319d9e8873734bb8e8cea3d762d7fab2ded887, the parent (the background thread) would delete us when it exits (i.e. never), so we had to keep track of our own refcount in order to destroy ourselves when we're done. With bc319d9e8873734bb8e8cea3d762d7fab2ded887, the parent keeps additional reference to us, so: * There should be no need to explicitly ref() ourselves * The unref() would not get rid of the last reference to us anymore The latter is why all the BackgroundAction's were getting leaked. Fix this by simply unparenting ourselves from the background thread when we're done.
2020-02-24LibThread: Post the completion callbacks to the *current* event loopAndreas Kling
FilePicker was not showing thumbnails correctly because once each thumbnail rendering BackgroundAction completed, it posted a deferred invocation event to the *main* event loop. Since FilePicker runs in a nested event loop, those completion callbacks never ran until it was too late and the FilePicker was gone.
2020-02-14LibCore: Add a forward declaration headerAndreas Kling
This patch adds <LibCore/Forward.h> and uses it in various places to shrink the header dependency graph.
2020-02-06LibCore: Remove leading C from filenamesAndreas Kling
2020-02-05LibThread: Store thread id as pthread_t, use pthread_self()joshua stein
Serenity calls pthread_self() for gettid() anyway but this makes it portable.
2020-02-02LibCore: Put all classes in the Core namespace and remove the leading CAndreas Kling
I've been wanting to do this for a long time. It's time we start being consistent about how this stuff works. The new convention is: - "LibFoo" is a userspace library that provides the "Foo" namespace. That's it :^) This was pretty tedious to convert and I didn't even start on LibGUI yet. But it's coming up next.
2020-01-24Meta: Claim copyright for files created by meSergey Bugaev
This changes copyright holder to myself for the source code files that I've created or have (almost) completely rewritten. Not included are the files that were significantly changed by others even though it was me who originally created them (think HtmlView), or the many other files I've contributed code to.
2020-01-23AK: Let's call decrementing reference counts "unref" instead of "deref"Andreas Kling
It always bothered me that we're using the overloaded "dereference" term for this. Let's call it "unreference" instead. :^)
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2020-01-11LibPthread: Fix incompatible pthread_setname_np(), pthread_getname_np()Andreas Kling
Other implementations of pthread_setname_np() do not take the name length as an argument. For pthread_getname_np(), other implementations take the buffer size as a size_t. This patch brings us in line with other implementations.
2019-12-20Build: clean up build system, use one shared Makefilejoshua stein
Allow everything to be built from the top level directory with just 'make', cleaned with 'make clean', and installed with 'make install'. Also support these in any particular subdirectory. Specifying 'make VERBOSE=1' will print each ld/g++/etc. command as it runs. Kernel and early host tools (IPCCompiler, etc.) are built as object.host.o so that they don't conflict with other things built with the cross-compiler.
2019-12-08LibThread: Allow setting thread name in constructorAndrew Kaster
Thread now has an optional thread_name parameter to the consturctor that will call pthread_setname_np if given.
2019-11-13LibPthread: Start working on a POSIX threading libraryAndreas Kling
This patch adds pthread_create() and pthread_exit(), which currently simply wrap our existing create_thread() and exit_thread() syscalls. LibThread is also ported to using LibPthread.
2019-11-03POSIX compliance: (most) shell scripts converted to generic shellGeorge Pickering
Ports/.port_include.sh, Toolchain/BuildIt.sh, Toolchain/UseIt.sh have been left largely untouched due to use of Bash-exclusive functions and variables such as $BASH_SOURCE, pushd and popd.
2019-10-12AK: Add Atomic.hTom
Use gcc built-in atomics
2019-09-22LibCore: Make CObject reference-countedAndreas Kling
Okay, I've spent a whole day on this now, and it finally kinda works! With this patch, CObject and all of its derived classes are reference counted instead of tree-owned. The previous, Qt-like model was nice and familiar, but ultimately also outdated and difficult to reason about. CObject-derived types should now be stored in RefPtr/NonnullRefPtr and each class can be constructed using the forwarding construct() helper: auto widget = GWidget::construct(parent_widget); Note that construct() simply forwards all arguments to an existing constructor. It is inserted into each class by the C_OBJECT macro, see CObject.h to understand how that works. CObject::delete_later() disappears in this patch, as there is no longer a single logical owner of a CObject.
2019-09-01LibThread: Add missing install.sh scriptAndreas Kling
This unbreaks the SDL port build.
2019-08-26LibThread: Move CLock to LibThread::LockSergey Bugaev
And adapt all the code that uses it.
2019-08-26LibThread: Introduce a new threading librarySergey Bugaev
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.