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:
parent
4f7690c2df
commit
a7e2cfcf4e
3 changed files with 12 additions and 5 deletions
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue