swig/Examples/test-suite/python/director_thread.i
William S Fulton 8a9f37eb53 missing return added
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7263 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-06-09 18:43:56 +00:00

43 lines
606 B
OpenEdge ABL

%module(directors="1") director_thread
%{
#include <pthread.h>
#include <iostream>
class Foo;
extern "C" void* working(void* t);
%}
%feature("director") Foo;
%inline {
class Foo {
public:
int val;
Foo() : val(0) {}
virtual ~Foo() {}
void run() {
pthread_t *t = new pthread_t;
pthread_create(t,NULL,working,this);
sleep(5);
}
virtual void do_foo() {
val += 1;
}
};
}
%inline {
extern "C" void* working(void* t) {
Foo* f = static_cast<Foo*>(t);
while (1) {
sleep(1);
f->do_foo();
}
return 0;
}
}