summaryrefslogtreecommitdiff
path: root/rts/posix/Itimer.c
Commit message (Collapse)AuthorAgeFilesLines
* Rename itimer to ticker in rts/posix for consistency.Andreas Klebinger2021-07-271-109/+0
|
* rts: Correctly call pthread_setname_np() on NetBSDPHO2021-05-071-5/+13
| | | | | | NetBSD supports pthread_setname_np() but it expects a printf-style format string and a string argument. Also use pthread for itimer on this platform.
* Tighten scope of non-POSIX visibility macrosViktor Dukhovni2021-04-301-0/+21
| | | | | | | The __BSD_VISIBLE and _DARWIN_C_SOURCE macros expose non-POSIX prototypes in system header files. We should scope these to just the ".c" modules that actually need them, and avoid defining them in header files used in other C modules.
* Always define USE_PTHREAD_FOR_ITIMER for FreeBSD.Gleb Popov2020-05-291-1/+1
|
* Enable USE_PTHREAD_FOR_ITIMER also on FreeBSDViktor Dukhovni2019-11-191-0/+3
| | | | | | | | | | | If using a pthread instead of a timer signal is more reliable, and has no known drawbacks, then FreeBSD is also capable of supporting this mode of operation (tested on FreeBSD 12 with GHC 8.8.1, but no reason why it would not also work on FreeBSD 11 or GHC 8.6). Proposed by Kevin Zhang in: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=241849
* rts: Use pthread itimer implementation on DarwinBen Gamari2016-12-071-0/+9
| | | | | | | | | | | | | | | | | We want to avoid using SIGALRM whenever possible since we will interrupt long-running system calls. See #10840. Test Plan: Validate on Darwin Reviewers: austin, erikd, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2796 GHC Trac Issues: #10840
* rts: Split up Itimer.cBen Gamari2016-05-011-299/+6
| | | | | | | | | | | | | | | | | This shouldn't have any functional changes. It merely splits up what are essentially three distinct codepaths which are melding together with CPP. At the moment I merely #include the implementation to use with CPP although this really feels very yucky. Reviewers: erikd, austin, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2130
* rts: Close livelock window due to rapid ticker enable/disableBen Gamari2016-05-011-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes #11830, where the RTS would livelock if run with `-I0` due to a regression introduced by bbdc52f3a6e6a28e209fb8f65699121d4ef3a4e3. The reason for this is that the new codepath introduced a subtle race condition: 1. one thread could request that the ticker stop and would block until the ticker in fact stopped 2. meanwhile, another thread could sneak in and restart the ticker this was implemented in such a way where thread (1) would end up blocked forever. The solution here is to simply not block. The worst that will happen is that timer fires again, but is ignored since the ticker is stopped. Test Plan: Validate, try reproduction case in #11830. Need to find a nice testcase. Reviewers: simonmar, erikd, hsyl20, austin Reviewed By: erikd, hsyl20 Subscribers: erikd, thomie Differential Revision: https://phabricator.haskell.org/D2129 GHC Trac Issues: #11830
* rts/posix/Itimer.c: Handle EINTR when reading timerfdErik de Castro Lopo2016-03-311-4/+9
| | | | | | | | | | | | | | | Commit 8626d76a72 added checking of the return value when reading from the `timer_fd` and calling `sysErrorBelch` to print a warning message. However some error causes (like EINTR) are benign and should just be ignored. Test Plan: validate Reviewers: hvr, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2040
* rtx/posix/Itimer.c: Handle return value of `read`Erik de Castro Lopo2016-03-111-1/+2
| | | | | | | | | | | | | | | | | | On Ubuntu libc's `read` function is marked with attribute `warn_unused_result` which was causing build failures on Harbourmaster. Test Plan: validate on Harbourmaster Reviewers: austin, hvr, bgamari Reviewed By: hvr, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1993 GHC Trac Issues: #11697
* rts/timer: use timerfd_* on Linux instead of alarm signalsSylvain HENRY2016-03-051-11/+80
| | | | | | | | | | | | Reviewers: erikd, simonmar, austin, bgamari Reviewed By: simonmar, bgamari Subscribers: hvr, thomie Differential Revision: https://phabricator.haskell.org/D1947 GHC Trac Issues: #10840
* Revert "rts: add Emacs 'Local Variables' to every .c file"Simon Marlow2014-09-291-8/+0
| | | | This reverts commit 39b5c1cbd8950755de400933cecca7b8deb4ffcd.
* rts: add Emacs 'Local Variables' to every .c fileAustin Seipp2014-07-281-0/+8
| | | | | | | | This will hopefully help ensure some basic consistency in the forward by overriding buffer variables. In particular, it sets the wrap length, the offset to 4, and turns off tabs. Signed-off-by: Austin Seipp <austin@well-typed.com>
* rts: delint/detab/dewhitespace Itimer.cAustin Seipp2014-07-281-5/+5
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* Use a pthread-based implementation of Itimer.c on iOSIan Lynagh2013-04-211-5/+50
| | | | | | | | Patch from Stephen Blackheath. timer_create doesn't exist and setitimer doesn't fire on iOS, so we're using a pthreads-based implementation. It may be to do with interference with the signals of the debugger. Revisit. See #7723.
* Solaris: do not use timer_createSimon Marlow2013-01-231-0/+18
| | | | Submitted by: Karel Gardas <karel.gardas@centrum.cz>
* rts: Ignore signal before deleting timer. Fixes #7303.Erik de Castro Lopo2012-10-141-0/+3
| | | | | | | Was getting an ocassional hang or segfault when building GHC in a Qemu user space emulation of ARM. Turned out that the ITIMER_SIGNAL was being delivered *after* the call to timer_delete(). Setting the signal to SIG_IGN before deleting the timer solves the problem.
* Use monotonic clock in Select.c (#5865)Paolo Capriotti2012-04-161-9/+2
|
* (some) tabs -> spacesGabor Greif2012-02-271-1/+1
|
* Fix for tick intervals greater than one second.Simon Marlow2012-01-161-2/+2
|
* Time handling overhaulSimon Marlow2011-11-251-77/+47
| | | | | | | | | | | | | | | | | | | | | Terminology cleanup: the type "Ticks" has been renamed "Time", which is an StgWord64 in units of TIME_RESOLUTION (currently nanoseconds). The terminology "tick" is now used consistently to mean the interval between timer signals. The ticker now always ticks in realtime (actually CLOCK_MONOTONIC if we have it). Before it used CPU time in the non-threaded RTS and realtime in the threaded RTS, but I've discovered that the CPU timer has terrible resolution (at least on Linux) and isn't much use for profiling. So now we always use realtime. This should also fix The default tick interval is now 10ms, except when profiling where we drop it to 1ms. This gives more accurate profiles without affecting runtime too much (<1%). Lots of cleanups - the resolution of Time is now in one place only (Rts.h) rather than having calculations that depend on the resolution scattered all over the RTS. I hope I found them all.
* Export the value of the signal used by scheduler (#4504)Dmitry Astapov2010-12-081-0/+6
|
* Don't Terminate the ticker thread (#3748)Simon Marlow2010-01-271-1/+1
|
* RTS tidyup sweep, first phaseSimon Marlow2009-08-021-30/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first phase of this tidyup is focussed on the header files, and in particular making sure we are exposinng publicly exactly what we need to, and no more. - Rts.h now includes everything that the RTS exposes publicly, rather than a random subset of it. - Most of the public header files have moved into subdirectories, and many of them have been renamed. But clients should not need to include any of the other headers directly, just #include the main public headers: Rts.h, HsFFI.h, RtsAPI.h. - All the headers needed for via-C compilation have moved into the stg subdirectory, which is self-contained. Most of the headers for the rest of the RTS APIs have moved into the rts subdirectory. - I left MachDeps.h where it is, because it is so widely used in Haskell code. - I left a deprecated stub for RtsFlags.h in place. The flag structures are now exposed by Rts.h. - Various internal APIs are no longer exposed by public header files. - Various bits of dead code and declarations have been removed - More gcc warnings are turned on, and the RTS code is more warning-clean. - More source files #include "PosixSource.h", and hence only use standard POSIX (1003.1c-1995) interfaces. There is a lot more tidying up still to do, this is just the first pass. I also intend to standardise the names for external RTS APIs (e.g use the rts_ prefix consistently), and declare the internal APIs as hidden for shared libraries.
* Handle the case where setitimer(ITIMER_VIRTUAL) is not always availableIan Lynagh2009-02-081-1/+2
| | | | Patch from sthibaul. Fixes trac #2883.
* Fix #2848: avoid overflow during time calculationSimon Marlow2008-12-091-3/+4
|
* Keep valgrind happy when calling timer_createsven.panne@aedion.de2007-09-161-0/+5
| | | | | | | | Fill all of the sigevent structure with zeroes before individual fields are set. Although not strictly necessary, this keeps tools like valgrind from complaining about passing uninitialized data, which is a good thing. MERGE TO STABLE
* fix build (sorry, forgot to push with previous patch)Simon Marlow2007-09-031-8/+14
|
* FIX #1623: disable the timer signal when the system is idle (threaded RTS only)Simon Marlow2007-09-031-7/+23
| | | | | | | | | | Having a timer signal go off regularly is bad for power consumption, and generally bad practice anyway (it means the app cannot be completely swapped out, for example). Fortunately the threaded RTS already had a way to detect when the system was idle, so that it can trigger a GC and thereby find deadlocks. After performing the GC, we now turn off timer signals, and re-enable them again just before running any Haskell code.
* fix +RTS -V0 when not using -threadedSimon Marlow2007-08-241-2/+5
|
* better autoconfery for timer_create()Simon Marlow2007-03-051-3/+1
|
* Use timer_create() for the interval timer, if availableSimon Marlow2007-03-021-77/+92
| | | | | | | | | | | This lets the threaded RTS use SIGVTALRM rather than SIGALRM for its interval timer signal, so the threaded and non-threaded RTS are compatible. It unfortunately doesn't completely fix #850/#1156, for that we really have to use a restartable sleep instead of usleep(). Also I cleaned up the timer API a little: instead of returning an error value that ultimately gets ignored, we now report errors from system calls and exit.
* Split GC.c, and move storage manager into sm/ directorySimon Marlow2006-10-241-0/+1
| | | | | | | | | | | | | | | | | In preparation for parallel GC, split up the monolithic GC.c file into smaller parts. Also in this patch (and difficult to separate, unfortunatley): - Don't include Stable.h in Rts.h, instead just include it where necessary. - consistently use STATIC_INLINE in source files, and INLINE_HEADER in header files. STATIC_INLINE is now turned off when DEBUG is on, to make debugging easier. - The GC no longer takes the get_roots function as an argument. We weren't making use of this generalisation.
* new RTS flag: -V to modify the resolution of the RTS timerIan Lynagh2006-09-051-2/+2
| | | | | | | | | Fixed version of an old patch by Simon Marlow. His description read: Also, now an arbitrarily short context switch interval may now be specified, as we increase the RTS ticker's resolution to match the requested context switch interval. This also applies to +RTS -i (heap profiling) and +RTS -I (the idle GC timer). +RTS -V is actually only required for increasing the resolution of the profile timer.
* Reorganisation of the source treeSimon Marlow2006-04-071-0/+226
Most of the other users of the fptools build system have migrated to Cabal, and with the move to darcs we can now flatten the source tree without losing history, so here goes. The main change is that the ghc/ subdir is gone, and most of what it contained is now at the top level. The build system now makes no pretense at being multi-project, it is just the GHC build system. No doubt this will break many things, and there will be a period of instability while we fix the dependencies. A straightforward build should work, but I haven't yet fixed binary/source distributions. Changes to the Building Guide will follow, too.