aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/thread.c
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2011-11-23 12:24:48 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2011-11-23 12:24:48 +0100
commitc269a1f5c9c3904c35ed2ac320e6620c7f47ea57 (patch)
tree3801b3b0ce11d58d1c4a23076336e38db3baa05d /gcc/ada/thread.c
parentf947ee3467dee8ca1b681c459804b02657113e9d (diff)
downloadgcc-c269a1f5c9c3904c35ed2ac320e6620c7f47ea57.zip
gcc-c269a1f5c9c3904c35ed2ac320e6620c7f47ea57.tar.gz
gcc-c269a1f5c9c3904c35ed2ac320e6620c7f47ea57.tar.bz2
[multiple changes]
2011-11-23 Robert Dewar <dewar@adacore.com> * sem_ch9.adb (Analyze_Entry_Declaration): Check for entry family bounds out of range. 2011-11-23 Matthew Heaney <heaney@adacore.com> * a-cohama.adb, a-cihama.adb, a-cbhama.adb (Iterator): Declare type as limited, and remove node component. (First, Next): Forward call to corresponding cursor-based operation. (Iterate): Representation of iterator no longer has node component. 2011-11-23 Yannick Moy <moy@adacore.com> * exp_util.adb: Revert previous change to remove side-effects in Alfa mode, which is not the correct thing to do for renamings. 2011-11-23 Thomas Quinot <quinot@adacore.com> * s-osinte-hpux.ads, s-taprop-vxworks.adb, s-taprop-tru64.adb, s-osinte-vxworks.ads, s-osinte-aix.ads, s-osinte-lynxos.ads, s-osinte-solaris-posix.ads, s-taprop-solaris.adb, a-exetim-posix.adb, s-osinte-irix.ads, s-osinte-solaris.ads, s-oscons-tmplt.c, s-taprop-irix.adb, s-osinte-hpux-dce.ads, Makefile.rtl, s-osinte-tru64.ads, s-osinte-darwin.ads, s-taprop.ads, s-osinte-freebsd.ads, s-osinte-lynxos-3.ads, s-taprop-hpux-dce.adb, s-taprop-posix.adb: Remove hard-coded clock ids; instead, generate them in System.OS_Constants. (System.OS_Constants.CLOCK_RT_Ada): New constant denoting the id of the clock providing Ada.Real_Time.Monotonic_Clock. * thread.c: New file. (__gnat_pthread_condattr_setup): New function. For platforms where CLOCK_RT_Ada is not CLOCK_REALTIME, set appropriate condition variable attribute. 2011-11-23 Yannick Moy <moy@adacore.com> * sem_ch3.adb: Restore the use of Expander_Active instead of Full_Expander_Active, so that the evaluation is forced in Alfa mode too. Otherwise, we end up with an unexpected insertion in a place where it is not supposed to happen, on default parameters of a call. 2011-11-23 Thomas Quinot <quinot@adacore.com> * prj-pp.adb, prj-pp.ads: Minor new addition: wrapper procedure "wpr" for Pretty_Print, for use from within gdb. From-SVN: r181660
Diffstat (limited to 'gcc/ada/thread.c')
-rw-r--r--gcc/ada/thread.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/gcc/ada/thread.c b/gcc/ada/thread.c
new file mode 100644
index 0000000..da67f7b
--- /dev/null
+++ b/gcc/ada/thread.c
@@ -0,0 +1,50 @@
+/****************************************************************************
+ * *
+ * GNAT COMPILER COMPONENTS *
+ * *
+ * T H R E A D *
+ * *
+ * C Implementation File *
+ * *
+ * Copyright (C) 2011, 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- *
+ * ware Foundation; either version 3, or (at your option) any later ver- *
+ * sion. GNAT is distributed in the hope that it will be useful, but WITH- *
+ * OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
+ * or FITNESS FOR A PARTICULAR PURPOSE. *
+ * *
+ * As a special exception under Section 7 of GPL version 3, you are granted *
+ * additional permissions described in the GCC Runtime Library Exception, *
+ * version 3.1, as published by the Free Software Foundation. *
+ * *
+ * You should have received a copy of the GNU General Public License and *
+ * a copy of the GCC Runtime Library Exception along with this program; *
+ * see the files COPYING3 and COPYING.RUNTIME respectively. If not, see *
+ * <http://www.gnu.org/licenses/>. *
+ * *
+ * GNAT was originally developed by the GNAT team at New York University. *
+ * Extensive contributions were provided by Ada Core Technologies Inc. *
+ * *
+ ****************************************************************************/
+
+/* This file provides utility functions to access the threads API */
+
+#include <pthread.h>
+#include <time.h>
+#include "s-oscons.h"
+
+int
+__gnat_pthread_condattr_setup(pthread_condattr_t *attr) {
+/*
+ * If using a clock other than CLOCK_REALTIME for the Ada Monotonic_Clock,
+ * the corresponding clock id must be set for condition variables.
+ * There are no clock_id's on Darwin.
+ */
+#if defined(__APPLE__) || ((CLOCK_RT_Ada) == (CLOCK_REALTIME))
+ return 0;
+#else
+ return pthread_condattr_setclock (attr, CLOCK_RT_Ada);
+#endif
+}