aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/thread.c
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2015-01-07 11:22:51 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2015-01-07 11:22:51 +0100
commited09416ff9ab07e5491373e9af15563b0a0def34 (patch)
tree92e7f939154e78a6d1f27eeeb657dea9a7317fb0 /gcc/ada/thread.c
parent6a989c79d4ac94a8922e97523ff13965ed5b0283 (diff)
downloadgcc-ed09416ff9ab07e5491373e9af15563b0a0def34.zip
gcc-ed09416ff9ab07e5491373e9af15563b0a0def34.tar.gz
gcc-ed09416ff9ab07e5491373e9af15563b0a0def34.tar.bz2
[multiple changes]
2015-01-07 Robert Dewar <dewar@adacore.com> * s-taprop-linux.adb, clean.adb: Minor reformatting. 2015-01-07 Arnaud Charlet <charlet@adacore.com> * s-tassta.adb: Relax some overzealous assertions. 2015-01-07 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb (Analyze_Return_Type): An call that returns a limited view of a type is legal when context is a thunk generated for operation inherited from an interface. * exp_ch6.adb (Expand_Simple_Function_Return): If context is a thunk and return type is an incomplete type do not continue expansion; thunk will be fully elaborated when generating code. 2015-01-07 Doug Rupp <rupp@adacore.com> * s-osinte-mingw.ads (LARGE_INTEGR): New subtype. (QueryPerformanceFrequency): New imported procedure. * s-taprop-mingw.adb (RT_Resolution): Call above and return resolution vice a hardcoded value. * s-taprop-solaris.adb (RT_Resolution): Call clock_getres and return resolution vice a hardcoded value. * s-linux-android.ads (clockid_t): New subtype. * s-osinte-aix.ads (clock_getres): New imported subprogram. * s-osinte-android.ads (clock_getres): Likewise. * s-osinte-freebsd.ads (clock_getres): Likewise. * s-osinte-solaris-posix.ads (clock_getres): Likewise. * s-osinte-darwin.ads (clock_getres): New subprogram. * s-osinte-darwin.adb (clock_getres): New subprogram. * thread.c (__gnat_clock_get_res) [__APPLE__]: New function. * s-taprop-posix.adb (RT_Resolution): Call clock_getres to calculate resolution vice hard coded value. 2015-01-07 Ed Schonberg <schonberg@adacore.com> * exp_util.adb (Make_CW_Equivalent_Type): If root type is a limited view, use non-limited view when available to create equivalent record type. 2015-01-07 Vincent Celier <celier@adacore.com> * gnatcmd.adb: Remove command Sync and any data and processing related to this command. Remove project processing for gnatstack. * prj-attr.adb: Remove package Synchonize and its attributes. From-SVN: r219291
Diffstat (limited to 'gcc/ada/thread.c')
-rw-r--r--gcc/ada/thread.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/gcc/ada/thread.c b/gcc/ada/thread.c
index 31309e0..bd3cfa6 100644
--- a/gcc/ada/thread.c
+++ b/gcc/ada/thread.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 2011-2013, Free Software Foundation, Inc. *
+ * Copyright (C) 2011-2014, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -54,3 +54,35 @@ __gnat_pthread_condattr_setup (void *attr) {
}
#endif
+
+#if defined (__APPLE__)
+#include <mach/mach.h>
+#include <mach/clock.h>
+#endif
+
+/* Return the clock ticks per nanosecond for Posix systems lacking the
+ Posix extension function clock_getres, or else 0 nsecs on error. */
+
+int
+__gnat_clock_get_res (void)
+{
+#if defined (__APPLE__)
+ clock_serv_t clock_port;
+ mach_msg_type_number_t count;
+ int nsecs;
+ int result;
+
+ count = 1;
+ result = host_get_clock_service
+ (mach_host_self (), SYSTEM_CLOCK, &clock_port);
+
+ if (result == KERN_SUCCESS)
+ result = clock_get_attributes (clock_port, CLOCK_GET_TIME_RES,
+ (clock_attr_t) &nsecs, &count);
+
+ if (result == KERN_SUCCESS)
+ return nsecs;
+#endif
+
+ return 0;
+}