]>
Commit | Line | Data |
---|---|---|
b6dc087e AM |
1 | --- OpenImageIO-oiio-bcdad81/src/field3d.imageio/CMakeLists.txt~ 2013-11-01 18:03:46.000000000 +0100 |
2 | +++ OpenImageIO-oiio-bcdad81/src/field3d.imageio/CMakeLists.txt 2013-11-05 21:12:41.033996632 +0100 | |
3 | @@ -1,5 +1,5 @@ | |
4 | if (USE_FIELD3D) | |
5 | - if (FIELD3D_FOUND and HDF5_FOUND) | |
6 | + if (FIELD3D_FOUND AND HDF5_FOUND) | |
7 | include_directories (${FIELD3D_INCLUDES}) | |
8 | add_oiio_plugin (field3dinput.cpp field3doutput.cpp | |
9 | LINK_LIBRARIES ${FIELD3D_LIBRARY} | |
11a6b195 AM |
10 | |
11 | From 77fd2276e12791dc17cb20526cd371d66140e416 Mon Sep 17 00:00:00 2001 | |
12 | From: Larry Gritz <lg@larrygritz.com> | |
13 | Date: Tue, 5 Nov 2013 16:05:43 -0800 | |
14 | Subject: [PATCH] Make cleaner threads.h compile for the NOTHREADS case | |
15 | ||
16 | --- | |
17 | src/include/thread.h | 27 ++++++++++++++++++++++----- | |
18 | 1 file changed, 22 insertions(+), 5 deletions(-) | |
19 | ||
20 | diff --git a/src/include/thread.h b/src/include/thread.h | |
21 | index e389ebb..ecf3e66 100644 | |
22 | --- a/src/include/thread.h | |
23 | +++ b/src/include/thread.h | |
24 | @@ -128,6 +128,7 @@ class null_mutex { | |
9a3eb542 AM |
25 | void unlock () { } |
26 | void lock_shared () { } | |
27 | void unlock_shared () { } | |
28 | + bool try_lock () { return true; } | |
29 | }; | |
30 | ||
31 | /// Null lock that can be substituted for a real one to test how much | |
11a6b195 AM |
32 | @@ -219,7 +220,9 @@ class thread_specific_ptr { |
33 | inline int | |
34 | atomic_exchange_and_add (volatile int *at, int x) | |
35 | { | |
36 | -#ifdef USE_GCC_ATOMICS | |
37 | +#ifdef NOTHREADS | |
38 | + int r = *at; *at += x; return r; | |
39 | +#elif defined(USE_GCC_ATOMICS) | |
40 | return __sync_fetch_and_add ((int *)at, x); | |
41 | #elif USE_TBB | |
42 | atomic<int> *a = (atomic<int> *)at; | |
43 | @@ -237,7 +240,9 @@ class thread_specific_ptr { | |
44 | inline long long | |
45 | atomic_exchange_and_add (volatile long long *at, long long x) | |
46 | { | |
47 | -#ifdef USE_GCC_ATOMICS | |
48 | +#ifdef NOTHREADS | |
49 | + long long r = *at; *at += x; return r; | |
50 | +#elif defined(USE_GCC_ATOMICS) | |
51 | return __sync_fetch_and_add (at, x); | |
52 | #elif USE_TBB | |
53 | atomic<long long> *a = (atomic<long long> *)at; | |
54 | @@ -261,11 +266,17 @@ class thread_specific_ptr { | |
55 | /// *at = newval; return true; | |
56 | /// } else { | |
57 | /// return false; | |
58 | -/// | |
59 | +/// } | |
60 | inline bool | |
61 | atomic_compare_and_exchange (volatile int *at, int compareval, int newval) | |
62 | { | |
63 | -#ifdef USE_GCC_ATOMICS | |
64 | +#ifdef NOTHREADS | |
65 | + if (*at == compareval) { | |
66 | + *at = newval; return true; | |
67 | + } else { | |
68 | + return false; | |
69 | + } | |
70 | +#elif defined(USE_GCC_ATOMICS) | |
71 | return __sync_bool_compare_and_swap (at, compareval, newval); | |
72 | #elif USE_TBB | |
73 | atomic<int> *a = (atomic<int> *)at; | |
74 | @@ -282,7 +293,13 @@ class thread_specific_ptr { | |
75 | inline bool | |
76 | atomic_compare_and_exchange (volatile long long *at, long long compareval, long long newval) | |
77 | { | |
78 | -#ifdef USE_GCC_ATOMICS | |
79 | +#ifdef NOTHREADS | |
80 | + if (*at == compareval) { | |
81 | + *at = newval; return true; | |
82 | + } else { | |
83 | + return false; | |
84 | + } | |
85 | +#elif defined(USE_GCC_ATOMICS) | |
86 | return __sync_bool_compare_and_swap (at, compareval, newval); | |
87 | #elif USE_TBB | |
88 | atomic<long long> *a = (atomic<long long> *)at; | |
89 | -- | |
90 | 1.8.4 | |
91 |