• R/O
  • SSH

libctools: Commit

This library contains code that extends and simplifies different operations
for C language based programs.


Commit MetaInfo

Revision0131297a766c6ce2a51a53ee8f2446bd32f9fe41 (tree)
Zeit2022-09-12 08:57:29
AutorSergey Gusarov <laborer2008@gmai...>
CommiterSergey Gusarov

Log Message

thread: Fixed compilation with mingw + without pthreads

Ändern Zusammenfassung

Diff

diff -r e13bcfe5d330 -r 0131297a766c src/os/mutex.c
--- a/src/os/mutex.c Mon Sep 12 02:45:17 2022 +0300
+++ b/src/os/mutex.c Mon Sep 12 02:57:29 2022 +0300
@@ -162,6 +162,10 @@
162162
163163 MutexPointer createMutex(void) CT_NOEXCEPT
164164 {
165+# if defined(CT_COMPL_MINGW) && defined (PTW32_VERSION)
166+ CT_COMPILE_WARNING(Unimplemented yet)
167+ return (MutexPointer)CT_NULL;
168+# else
165169 MutexPointer mutexPointer;
166170
167171 do
@@ -186,6 +190,7 @@
186190 while (CT_FALSE);
187191
188192 return mutexPointer;
193+# endif
189194 }
190195
191196 void releaseMutex(MutexPointer* mutexDoublePointer) CT_NOEXCEPT
@@ -193,6 +198,9 @@
193198 CT_CHECK_PTR_AND_RETURN(mutexDoublePointer);
194199 CT_CHECK_PTR_AND_RETURN(*mutexDoublePointer);
195200
201+# if defined(CT_COMPL_MINGW) && defined (PTW32_VERSION)
202+ CT_COMPILE_WARNING(Unimplemented yet)
203+# else
196204 const int kErrCode = pthread_mutex_destroy(*mutexDoublePointer);
197205 const int kOk = 0; // The function always return it(should)
198206
@@ -201,28 +209,37 @@
201209
202210 free(*mutexDoublePointer);
203211 *mutexDoublePointer = CT_NULL;
212+# endif
204213 }
205214
206215 void lockMutex(MutexPointer mutexPointer) CT_NOEXCEPT
207216 {
208217 CT_CHECK_PTR_AND_RETURN(mutexPointer);
209218
219+# if defined(CT_COMPL_MINGW) && defined (PTW32_VERSION)
220+ CT_COMPILE_WARNING(Unimplemented yet)
221+# else
210222 const int kErrCode = pthread_mutex_lock(mutexPointer);
211223 const int kOk = 0; // The function always return it(should)
212224
213225 if (CT_UNLIKELY(kErrCode != kOk))
214226 CT_TRACE_ERRORC("pthread_mutex_lock() failed: %d", kErrCode);
227+# endif
215228 }
216229
217230 void unLockMutex(MutexPointer mutexPointer) CT_NOEXCEPT
218231 {
219232 CT_CHECK_PTR_AND_RETURN(mutexPointer);
220233
234+# if defined(CT_COMPL_MINGW) && defined (PTW32_VERSION)
235+ CT_COMPILE_WARNING(Unimplemented yet)
236+# else
221237 const int kErrCode = pthread_mutex_unlock(mutexPointer);
222238 const int kOk = 0; // The function always return it(should)
223239
224240 if (CT_UNLIKELY(kErrCode != kOk))
225241 CT_TRACE_ERRORC("pthread_mutex_unlock() failed: %d", kErrCode);
242+# endif
226243 }
227244
228245 # endif // defined (CT_COMPL_MSVC)
diff -r e13bcfe5d330 -r 0131297a766c src/os/thread.c
--- a/src/os/thread.c Mon Sep 12 02:45:17 2022 +0300
+++ b/src/os/thread.c Mon Sep 12 02:57:29 2022 +0300
@@ -57,6 +57,7 @@
5757 # if defined(CT_COMPL_MINGW) && defined (PTW32_VERSION)
5858 // win32 threads, pthread_t here is a struct
5959 CT_COMPILE_WARNING(Unimplemented yet)
60+ return false;
6061 # else
6162 const int kErrCode = pthread_cancel(**threadDoublePointer);
6263 const bool kStatus = kErrCode == 0;
Show on old repository browser