diff --git a/SWIG/Examples/test-suite/python/Makefile.in b/SWIG/Examples/test-suite/python/Makefile.in index 26717f352..b34c54b03 100644 --- a/SWIG/Examples/test-suite/python/Makefile.in +++ b/SWIG/Examples/test-suite/python/Makefile.in @@ -17,6 +17,7 @@ CPP_TEST_CASES += \ callback \ complextest \ director_stl \ + director_thread \ file_test \ implicittest \ inout \ diff --git a/SWIG/Examples/test-suite/python/director_thread.i b/SWIG/Examples/test-suite/python/director_thread.i index ec2bca923..3bc1721e0 100644 --- a/SWIG/Examples/test-suite/python/director_thread.i +++ b/SWIG/Examples/test-suite/python/director_thread.i @@ -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(t); while (1) { sleep(1); - std::cout << "invoked" << std::endl; f->do_foo(); } } diff --git a/SWIG/Examples/test-suite/python/director_thread_runme.py b/SWIG/Examples/test-suite/python/director_thread_runme.py index bec902103..93882976c 100644 --- a/SWIG/Examples/test-suite/python/director_thread_runme.py +++ b/SWIG/Examples/test-suite/python/director_thread_runme.py @@ -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