add director+thread case

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7148 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-04-08 06:57:25 +00:00
commit a7e2cfcf4e
3 changed files with 12 additions and 5 deletions

View file

@ -17,6 +17,7 @@ CPP_TEST_CASES += \
callback \
complextest \
director_stl \
director_thread \
file_test \
implicittest \
inout \

View file

@ -14,8 +14,11 @@ extern "C" void* working(void* t);
%inline {
class Foo {
public:
virtual ~Foo() {}
int val;
Foo() : val(0) {}
virtual ~Foo() {}
void run() {
pthread_t *t = new pthread_t;
pthread_create(t,NULL,working,this);
@ -23,7 +26,7 @@ extern "C" void* working(void* t);
}
virtual void do_foo() {
std::cout << "foo" << std::endl;
val += 1;
}
};
}
@ -33,7 +36,6 @@ extern "C" void* working(void* t);
Foo* f = static_cast<Foo*>(t);
while (1) {
sleep(1);
std::cout << "invoked" << std::endl;
f->do_foo();
}
}

View file

@ -3,9 +3,13 @@ from director_thread import Foo
class Derived(Foo) :
def __init__(self):
Foo.__init__(self)
print "too"
def do_foo(self):
print "at drived class"
self.val -= 1
d = Derived()
d.run()
if d.val >= 0:
raise RuntimeError