hornetseye-kinect 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ require 'rake/loaders/makefile'
7
7
  require 'rbconfig'
8
8
 
9
9
  PKG_NAME = 'hornetseye-kinect'
10
- PKG_VERSION = '0.2.3'
10
+ PKG_VERSION = '0.2.4'
11
11
  CFG = RbConfig::CONFIG
12
12
  CXX = ENV[ 'CXX' ] || 'g++'
13
13
  RB_FILES = FileList[ 'lib/**/*.rb' ]
@@ -27,8 +27,8 @@ EMAIL = %q{jan@wedesoft.de}
27
27
  HOMEPAGE = %q{http://wedesoft.github.com/hornetseye-kinect/}
28
28
 
29
29
  OBJ = CC_FILES.ext 'o'
30
- $CXXFLAGS = "-DNDEBUG #{CFG[ 'CPPFLAGS' ]} #{CFG[ 'CFLAGS' ]}"
31
- # $CXXFLAGS = "-g #{CFG[ 'CPPFLAGS' ]} #{CFG[ 'CFLAGS' ]}"
30
+ # $CXXFLAGS = "-DNDEBUG #{CFG[ 'CPPFLAGS' ]} #{CFG[ 'CFLAGS' ]}"
31
+ $CXXFLAGS = "-g #{CFG[ 'CPPFLAGS' ]} #{CFG[ 'CFLAGS' ]}"
32
32
  if CFG[ 'rubyhdrdir' ]
33
33
  $CXXFLAGS = "#{$CXXFLAGS} -I#{CFG[ 'rubyhdrdir' ]} " +
34
34
  "-I#{CFG[ 'rubyhdrdir' ]}/#{CFG[ 'arch' ]}"
data/ext/kinectcontext.cc CHANGED
@@ -26,15 +26,13 @@ using namespace std;
26
26
  VALUE KinectContext::cRubyClass = Qnil;
27
27
 
28
28
  KinectContext::KinectContext(void) throw (Error):
29
- m_usb(NULL), m_context(NULL), m_instances(0)
29
+ m_usb(NULL), m_context(NULL), m_instances(0), m_threadInitialised(false)
30
30
  {
31
31
  pthread_mutex_init( &m_mutex, NULL );
32
32
  pthread_cond_init( &m_cond, NULL );
33
33
  ERRORMACRO( libusb_init( &m_usb ) == 0, Error, , "Error creating libusb session" );
34
34
  freenect_init( &m_context, m_usb );
35
35
  ERRORMACRO( m_context != NULL, Error, , "Initialisation of libfreenect failed" );
36
- pthread_create( &m_thread, NULL, staticThreadFunc, this );
37
- pthread_cond_wait( &m_cond, &m_mutex );
38
36
  }
39
37
 
40
38
  KinectContext::~KinectContext(void)
@@ -46,7 +44,9 @@ void KinectContext::addInstance(void)
46
44
  {
47
45
  m_instances++;
48
46
  if ( m_instances == 1 ) {
47
+ if ( m_threadInitialised ) pthread_detach( m_thread );
49
48
  pthread_create( &m_thread, NULL, staticThreadFunc, this );
49
+ m_threadInitialised = true;
50
50
  };
51
51
  }
52
52
 
@@ -61,7 +61,10 @@ void KinectContext::removeInstance(void)
61
61
  void KinectContext::close(void)
62
62
  {
63
63
  if ( m_context != NULL ) {
64
- pthread_join( m_thread, NULL );
64
+ if ( m_threadInitialised ) {
65
+ pthread_join( m_thread, NULL );
66
+ m_threadInitialised = false;
67
+ };
65
68
  pthread_mutex_destroy( &m_mutex );
66
69
  pthread_cond_destroy( &m_cond );
67
70
  freenect_shutdown( m_context );
data/ext/kinectcontext.hh CHANGED
@@ -45,6 +45,7 @@ protected:
45
45
  libusb_context *m_usb;
46
46
  freenect_context *m_context;
47
47
  pthread_t m_thread;
48
+ bool m_threadInitialised;
48
49
  pthread_mutex_t m_mutex;
49
50
  pthread_cond_t m_cond;
50
51
  int m_instances;
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 3
9
- version: 0.2.3
8
+ - 4
9
+ version: 0.2.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jan Wedekind
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-03-15 00:00:00 +00:00
17
+ date: 2011-05-10 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency