Skip to content

Commit 70eb87e

Browse files
committed
Fixed issue with PTHREAD_MUTEX_INITIALIZE not working in object constructors on OS X gcc
Signed-off-by: Kyle Machulis <kyle@nonpolynomial.com>
1 parent 3a24bb8 commit 70eb87e

File tree

1 file changed

+57
-57
lines changed

1 file changed

+57
-57
lines changed

examples/cppview.cpp

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
/*This file is part of the OpenKinect Project. http://www.openkinect.org
22
3-
Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB
4-
file for details.
3+
Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB
4+
file for details.
55
6-
This code is licensed to you under the terms of the Apache License,
7-
version 2.0, or, at your option, the terms of the GNU General Public
8-
License, version 2.0. See the APACHE20 and GPL2 files for the text of
9-
the licenses, or the following URLs:
10-
http://www.apache.org/licenses/LICENSE-2.0
11-
http://www.gnu.org/licenses/gpl-2.0.txt
6+
This code is licensed to you under the terms of the Apache License,
7+
version 2.0, or, at your option, the terms of the GNU General Public
8+
License, version 2.0. See the APACHE20 and GPL2 files for the text of
9+
the licenses, or the following URLs:
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
http://www.gnu.org/licenses/gpl-2.0.txt
1212
13-
If you redistribute this file in source form, modified or unmodified,
14-
you may:
13+
If you redistribute this file in source form, modified or unmodified,
14+
you may:
1515
16-
- Leave this header intact and distribute it under the same terms,
16+
- Leave this header intact and distribute it under the same terms,
1717
accompanying it with the APACHE20 and GPL2 files, or
18-
- Delete the Apache 2.0 clause and accompany it with the GPL2 file, or
19-
- Delete the GPL v2 clause and accompany it with the APACHE20 file
18+
- Delete the Apache 2.0 clause and accompany it with the GPL2 file, or
19+
- Delete the GPL v2 clause and accompany it with the APACHE20 file
2020
21-
In all cases you must keep the copyright notice intact and include a
22-
copy of the CONTRIB file.
21+
In all cases you must keep the copyright notice intact and include a
22+
copy of the CONTRIB file.
2323
24-
Binary distributions must follow the binary distribution requirements
25-
of either License.*/
24+
Binary distributions must follow the binary distribution requirements
25+
of either License.*/
2626

2727

2828
#include "libfreenect.hpp"
@@ -45,23 +45,23 @@ of either License.*/
4545

4646

4747
class Mutex {
48-
public:
48+
public:
4949
Mutex() {
50-
m_mutex=PTHREAD_MUTEX_INITIALIZER;
50+
pthread_mutex_init( &m_mutex, NULL );
5151
}
5252
void lock() {
5353
pthread_mutex_lock( &m_mutex );
5454
}
5555
void unlock() {
5656
pthread_mutex_unlock( &m_mutex );
5757
}
58-
private:
58+
private:
5959
pthread_mutex_t m_mutex;
6060
};
6161

6262
/* thanks to Yoda---- from IRC */
6363
class MyFreenectDevice : public Freenect::FreenectDevice {
64-
public:
64+
public:
6565
MyFreenectDevice(freenect_context *_ctx, int _index)
6666
: Freenect::FreenectDevice(_ctx, _index), m_buffer_depth(FREENECT_VIDEO_RGB_SIZE),m_buffer_video(FREENECT_VIDEO_RGB_SIZE), m_gamma(2048), m_new_rgb_frame(false), m_new_depth_frame(false)
6767
{
@@ -89,41 +89,41 @@ class MyFreenectDevice : public Freenect::FreenectDevice {
8989
int pval = m_gamma[depth[i]];
9090
int lb = pval & 0xff;
9191
switch (pval>>8) {
92-
case 0:
93-
m_buffer_depth[3*i+0] = 255;
94-
m_buffer_depth[3*i+1] = 255-lb;
95-
m_buffer_depth[3*i+2] = 255-lb;
96-
break;
97-
case 1:
98-
m_buffer_depth[3*i+0] = 255;
99-
m_buffer_depth[3*i+1] = lb;
100-
m_buffer_depth[3*i+2] = 0;
101-
break;
102-
case 2:
103-
m_buffer_depth[3*i+0] = 255-lb;
104-
m_buffer_depth[3*i+1] = 255;
105-
m_buffer_depth[3*i+2] = 0;
106-
break;
107-
case 3:
108-
m_buffer_depth[3*i+0] = 0;
109-
m_buffer_depth[3*i+1] = 255;
110-
m_buffer_depth[3*i+2] = lb;
111-
break;
112-
case 4:
113-
m_buffer_depth[3*i+0] = 0;
114-
m_buffer_depth[3*i+1] = 255-lb;
115-
m_buffer_depth[3*i+2] = 255;
116-
break;
117-
case 5:
118-
m_buffer_depth[3*i+0] = 0;
119-
m_buffer_depth[3*i+1] = 0;
120-
m_buffer_depth[3*i+2] = 255-lb;
121-
break;
122-
default:
123-
m_buffer_depth[3*i+0] = 0;
124-
m_buffer_depth[3*i+1] = 0;
125-
m_buffer_depth[3*i+2] = 0;
126-
break;
92+
case 0:
93+
m_buffer_depth[3*i+0] = 255;
94+
m_buffer_depth[3*i+1] = 255-lb;
95+
m_buffer_depth[3*i+2] = 255-lb;
96+
break;
97+
case 1:
98+
m_buffer_depth[3*i+0] = 255;
99+
m_buffer_depth[3*i+1] = lb;
100+
m_buffer_depth[3*i+2] = 0;
101+
break;
102+
case 2:
103+
m_buffer_depth[3*i+0] = 255-lb;
104+
m_buffer_depth[3*i+1] = 255;
105+
m_buffer_depth[3*i+2] = 0;
106+
break;
107+
case 3:
108+
m_buffer_depth[3*i+0] = 0;
109+
m_buffer_depth[3*i+1] = 255;
110+
m_buffer_depth[3*i+2] = lb;
111+
break;
112+
case 4:
113+
m_buffer_depth[3*i+0] = 0;
114+
m_buffer_depth[3*i+1] = 255-lb;
115+
m_buffer_depth[3*i+2] = 255;
116+
break;
117+
case 5:
118+
m_buffer_depth[3*i+0] = 0;
119+
m_buffer_depth[3*i+1] = 0;
120+
m_buffer_depth[3*i+2] = 255-lb;
121+
break;
122+
default:
123+
m_buffer_depth[3*i+0] = 0;
124+
m_buffer_depth[3*i+1] = 0;
125+
m_buffer_depth[3*i+2] = 0;
126+
break;
127127
}
128128
}
129129
m_new_depth_frame = true;
@@ -155,7 +155,7 @@ class MyFreenectDevice : public Freenect::FreenectDevice {
155155
}
156156
}
157157

158-
private:
158+
private:
159159
std::vector<uint8_t> m_buffer_depth;
160160
std::vector<uint8_t> m_buffer_video;
161161
std::vector<uint16_t> m_gamma;

0 commit comments

Comments
 (0)