nifi-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #674: Minificpp 1007 - ECU C2 integration.
Date Tue, 28 Jan 2020 18:00:32 GMT
szaszm commented on a change in pull request #674: Minificpp 1007 - ECU C2 integration.
URL: https://github.com/apache/nifi-minifi-cpp/pull/674#discussion_r371778635
 
 

 ##########
 File path: nanofi/include/core/synchutils.h
 ##########
 @@ -0,0 +1,82 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SYNCHUTILS_H_
+#define SYNCHUTILS_H_
+
+#ifdef WIN32
+#include <windows.h>
+#include <process.h>
+#include <synchapi.h>
+#else
+#include <pthread.h>
+#include <time.h>
+#endif
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct lock {
+#ifdef WIN32
+    CRITICAL_SECTION cs;
+#else
+    pthread_mutex_t mutex;
+#endif
+} lock_t ;
+
+typedef struct conditionvariable {
+#ifdef WIN32
+    CONDITION_VARIABLE cv;
+#else
+    pthread_cond_t cv;
+#endif
+} conditionvariable_t;
+
+typedef struct conditionvariable_attr {
+#ifndef WIN32
+    pthread_condattr_t cv_attr;
+#endif
+    unsigned int initialized : 1;
+} conditionvariable_attr_t;
 
 Review comment:
   Introducing platform-independent types for synchronization is a great idea, but what's
the reason for wrapping in a `struct` in addition to `typedef`?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message