summaryrefslogtreecommitdiff
path: root/src/systhread.h
Commit message (Collapse)AuthorAgeFilesLines
* ; Add 2023 to copyright years.Eli Zaretskii2023-01-011-1/+1
|
* Port better to C23 bool+true+false keywordsPaul Eggert2022-09-281-2/+0
| | | | | | | | | | | | | | | | | | | | C23 is adding the C++ keywords bool, true, and false; prefer them to <stdbool.h> if they are available. * admin/merge-gnulib (GNULIB_MODULES): Add stdbool, which emulates C23 on pre-C23 platforms. (AVOIDED_MODULES): Remove stdbool; Gnulib has renamed this module to stdbool-c99 and nobody uses it so it does not need to be avoided. * m4/c-bool.m4: New file, from Gnulib stdbool module. * lib-src/seccomp-filter.c, src/conf_post.h, src/dynlib.h: * src/emacs-module.c, src/nsterm.m, src/systhread.h: * test/src/emacs-module-resources/mod-test.c: Use the C23 style and use bool without including <stdbool.h>. The Gnulib stdbool module causes config.h to include stdbool.h on pre-C23 platforms. * src/emacs-module.h.in: Don’t include <stdbool.h> if C23 or later, or if it has already been included.
* Do not include <attribute.h> from <config.h>Paul Eggert2022-03-081-0/+2
| | | | | | | | | | | | This is because mod-test.c shouldn’t use source code from lib, but it does need to include <config.h>. * lib-src/ebrowse.c, lib-src/emacsclient.c, lib-src/etags.c: * lib-src/make-docfile.c, lib-src/movemail.c: * lib-src/seccomp-filter.c, src/dynlib.h, src/lisp.h: * src/syssignal.h, src/sysstdio.h, src/systhread.h, src/tparam.h: Include <attribute.h>. * src/conf_post.h: Do not include <attribute.h>. All uses of attribute.h macros replaced with their _GL_ equivalents.
* ; Add 2022 to copyright years.Eli Zaretskii2022-01-011-1/+1
|
* Port systhreads.h to C2xPaul Eggert2021-10-031-8/+5
| | | | | | * src/systhread.h: Put NODISCARD at the start of extern declarations, not at the end. This is needed by C2x. This patch also pacifies gcc 11.2.1 -Wattributes.
* Update copyright year to 2021Paul Eggert2021-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright".
* Simplify by using attribute.h macrosPaul Eggert2020-05-031-9/+3
| | | | | | | | | | | | | | | | | | attribute.h is partly designed for C2X forward compatibility, since C2X will add some standard attributes. Using its macros should help insulate Emacs from C2X teething problems. * src/conf_post.h: Include attribute.h. (HAS_ATTRIBUTE, HAS_FEATURE): Rename from __has_attribute and __has_feature, to avoid polluting the builtin namespace. All uses changed. (ATTRIBUTE_COLD, ATTRIBUTE_FORMAT, FALLTHROUGH, ATTRIBUTE_CONST) (ATTRIBUTE_PURE, ATTRIBUTE_UNUSED, ATTRIBUTE_MAY_ALIAS) (ATTRIBUTE_MALLOC, ATTRIBUTE_ALLOC_SIZE) (ATTRIBUTE_RETURNS_NONNULL): Remove, as attribute.h does this now. (NO_INLINE, EXTERNALLY_VISIBLE, ARG_NONNULL, ATTRIBUTE_UNUSED): Simplify by defining in terms of attribute.h macros. * src/systhread.h (ATTRIBUTE_WARN_UNUSED_RESULT): Remove. All uses replaced by attribute.h’s NODISCARD.
* Fix BSD and macOS builds w.r.t. pthread_setname_np (bug#38632)Mattias Engdegård2020-01-071-2/+3
| | | | | | | | | | | | | | | pthread_setname_np takes only a single argument on BSD and macOS, and affects the current thread only. * configure.ac: Add check for single-argument pthread_setname_np * src/systhread.c (sys_thread_set_name): New (w32 and pthread versions). (sys_thread_create): Remove name argument and name-setting. (w32_beginthread_wrapper): Remove name-setting. * src/systhread.h (sys_thread_create, sys_thread_set_name): Update prototypes. * src/thread.c (run_thread): Call sys_thread_set_name. (Fmake_thread): Adapt call to sys_thread_create. * src/thread.h (struct thread_state): Adjust comment.
* Update copyright year to 2020Paul Eggert2020-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
* Improve wur coverage on older GCCsPaul Eggert2019-04-221-6/+2
| | | | | | | * src/conf_post.h (__has_attribute_warn_unused_result): New macro for compilers lacking __has_attribute. * src/systhread.h (__has_attribute): Remove ineffective define. (ATTRIBUTE_WARN_UNUSED_RESULT): Work better on GCC 3.4 thru 4.
* Merge from origin/emacs-26Paul Eggert2018-12-311-1/+1
|\ | | | | | | | | | | 2fcf2df Fix copyright years by hand 26bed8b Update copyright year to 2019 2814292 Fix value of default frame height. (Bug#33921)
| * Update copyright year to 2019Paul Eggert2019-01-011-1/+1
| | | | | | | | Run 'TZ=UTC0 admin/update-copyright $(git ls-files)'.
* | Make error checking for thread functions stricter.Philipp Stephani2018-06-091-5/+19
| | | | | | | | | | | | | | | | | | | | | | | | * src/systhread.c (sys_thread_create): Change return type to bool. Check for errors returned by pthread_attr_setstacksize and pthread_attr_destroy. (sys_mutex_init): Abort on errors. Enable mutex checks when checking is enabled. (sys_cond_init): Abort on errors. (sys_mutex_lock, sys_mutex_unlock, sys_cond_wait) (sys_cond_signal, sys_cond_broadcast, sys_cond_destroy): Check for errors in debug mode.
* | Fix module support if threads are disabled (Bug#30106)Philipp Stephani2018-01-181-0/+1
|/ | | | | | * src/systhread.c (sys_thread_equal): New function. * src/thread.c (in_current_thread): Move from emacs-module.c; use sys_thread_equal.
* Update copyright year to 2018Paul Eggert2018-01-011-1/+1
| | | | Run admin/update-copyright.
* Prefer HTTPS to FTP and HTTP in documentationPaul Eggert2017-09-131-1/+1
| | | | | | | | | | | | | Most of this change is to boilerplate commentary such as license URLs. This change was prompted by ftp://ftp.gnu.org's going-away party, planned for November. Change these FTP URLs to https://ftp.gnu.org instead. Make similar changes for URLs to other organizations moving away from FTP. Also, change HTTP to HTTPS for URLs to gnu.org and fsf.org when this works, as this will further help defend against man-in-the-middle attacks (for this part I omitted the MS-DOS and MS-Windows sources and the test tarballs to keep the workload down). HTTPS is not fully working to lists.gnu.org so I left those URLs alone for now.
* Remove a few unused C functionsPaul Eggert2017-02-261-2/+0
| | | | | | | | | * src/eval.c (let_shadows_global_binding_p): * src/print.c (write_string): * src/systhread.c (sys_mutex_destroy, sys_thread_equal): Remove. * src/print.c (write_string): Rename from write_string_1. All uses changed.
* Update copyright year to 2017 in masterPaul Eggert2017-01-011-1/+1
| | | | | | Run admin/update-copyright in the master branch. This fixes files that were not already fixed in the emacs-25 branch before it was merged here.
* ; Fix copyright years in new filesGlenn Morris2016-12-101-1/+1
|
* Improve MS-Windows implementation of threads.Eli Zaretskii2013-08-311-2/+6
| | | | | | | | | | | | | | | | | | src/systhread.c (sys_cond_init): Set the 'initialized' member to true only if initialization is successful. Initialize wait_count and wait_count_lock. (sys_cond_wait, sys_cond_signal, sys_cond_broadcast): If 'initialized' is false, do nothing. (sys_cond_wait): Fix the implementation to avoid the "missed wakeup" bug: count the waiting threads, and reset the broadcast event once the last thread was released. (sys_cond_signal, sys_cond_broadcast): Use SetEvent instead of PulseEvent. Don't signal the event if no threads are waiting. (sys_cond_destroy): Only close non-NULL handles. (sys_thread_create): Return zero if unsuccessful, 1 if successful. src/systhread.h (w32thread_cond_t): New member 'initialized'. Rename waiters_count and waiters_count_lock to wait_count and wait_count_lock, respectively.
* Enable thread support in the MS-Windows build.Eli Zaretskii2013-08-301-0/+34
| | | | | | | | | | | | | src/systhread.h (w32thread_critsect, w32thread_cond_t, sys_mutex_t) (sys_cond_t, sys_thread_t) [WINDOWSNT]: New data types. src/systhread.c (sys_mutex_init, sys_mutex_lock, sys_mutex_unlock) (sys_mutex_destroy, sys_cond_init, sys_cond_wait) (sys_cond_signal, sys_cond_broadcast, sys_cond_destroy) (sys_thread_self, sys_thread_equal, w32_beginthread_wrapper) (sys_thread_create, sys_thread_yield) [WINDOWSNT]: New functions. configure.ac (THREADS_ENABLED): Enable threads for MinGW, even if pthreads is not available.
* implement --enable-threads and a thread-less modeTom Tromey2013-08-261-3/+14
|
* pass the thread name to the OS if possibleTom Tromey2012-08-201-1/+2
| | | | use prctl to pass the thread name to the OS, if possible
* refactor systhread.hTom Tromey2012-08-181-18/+0
| | | | | | This refactors systhread.h to move the notion of a "lisp mutex" into thread.c. This lets us make make the global lock and post_acquire_global_lock static.
* This introduces the low-level system threading support. It also addsTom Tromey2012-08-151-0/+80
the global lock. The low-level support is a bit over-eager, in that even at the end of the present series, it will not all be used. I think thiat is ok since I plan to use it all eventually -- in particular for the emacs lisp mutex implementation. I've only implemented the pthreads-based version. I think it should be relatively clear how to port this to other systems, though. I'd also like to do a "no threads" port that will turn most things into no-ops, and have thread-creation fail. I was thinking perhaps I'd make a future (provide 'threads) conditional on threads actually working. One other minor enhancement available here is to make it possible to set the name of the new thread at the OS layer. That way gdb, e.g., could display thread names.