]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
multi.c (_gfortran_caf_register): New function.
authorThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 2 Sep 2018 18:31:54 +0000 (18:31 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 2 Sep 2018 18:31:54 +0000 (18:31 +0000)
2018-09-02  Thomas Koenig  <tkoenig@gcc.gnu.org>

* caf/multi.c (_gfortran_caf_register): New function.
(_gfortran_caf_lock): New function.
(_gfortran_caf_unlock): New function.

From-SVN: r264044

libgfortran/ChangeLog.dev
libgfortran/caf/multi.c

index d466bec4ccbd8c12adc7cc323c063cc6c1a93f0a..b051202f12f168488521bd30ab41e3d3d5a28030 100644 (file)
@@ -1,3 +1,9 @@
+2018-09-02  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       * caf/multi.c (_gfortran_caf_register): New function.
+       (_gfortran_caf_lock): New function.
+       (_gfortran_caf_unlock): New function.
+
 2018-09-02  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        * caf/multi.c (_gfortran_caf_sync_images): Handle
index d02e49db4d1831bde694be4b391907598b216de3..f4a700ce88f1ecb7d17033700b7ab25f0a2fc83c 100644 (file)
@@ -123,6 +123,48 @@ _gfortran_caf_init (int *argcptr, char ***argvptr)
   pthread_barrier_wait (&sync_all_barrier);
 }
 
+/* Implementation of caf_register - so far only good enough to allow for
+   CRITICAL / END CRITICAL.  */
+
+void
+_gfortran_caf_register (size_t size, caf_register_t type, caf_token_t *token,
+                       gfc_descriptor_t *data, int *stat, char *errmsg,
+                       size_t errmsg_len)
+{
+  if (type == CAF_REGTYPE_CRITICAL)
+    {
+      pthread_mutex_t *mutex, **mp;
+      mutex = malloc (sizeof *mutex);
+      pthread_mutex_init (mutex, NULL);
+      mp = token;
+      *mp = mutex;
+    }
+}
+
+/* Implement a lock.  */
+
+void
+_gfortran_caf_lock (caf_token_t token, size_t index,
+                   int image_index __attribute__ ((unused)),
+                   int *aquired_lock, int *stat, char *errmsg, size_t errmsg_len)
+{
+  pthread_mutex_t *mutex;
+  mutex = token;
+  pthread_mutex_lock (mutex);
+}
+
+/* Implement an unlock.  */
+
+void
+_gfortran_caf_unlock (caf_token_t token, size_t index,
+                     int image_index __attribute__ ((unused)),
+                     int *stat, char *errmsg, size_t errmsg_len)
+{
+  pthread_mutex_t *mutex;
+  mutex = token;
+  pthread_mutex_unlock (mutex);
+}
+
 /*
 Doesn't work
 void