move this test up one directory so it can be used by all languages
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9240 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
f73d9274b9
commit
683ab90d1a
1 changed files with 0 additions and 47 deletions
|
|
@ -1,47 +0,0 @@
|
||||||
%module(directors="1",threads="1") director_thread
|
|
||||||
|
|
||||||
%{
|
|
||||||
#include <pthread.h>
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
class Foo;
|
|
||||||
extern "C" void* working(void* t);
|
|
||||||
%}
|
|
||||||
|
|
||||||
%director Foo;
|
|
||||||
|
|
||||||
%inline {
|
|
||||||
class Foo {
|
|
||||||
public:
|
|
||||||
int val;
|
|
||||||
pthread_t *t;
|
|
||||||
|
|
||||||
Foo() : val(0) {
|
|
||||||
t = new pthread_t;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~Foo() {
|
|
||||||
delete t;
|
|
||||||
}
|
|
||||||
|
|
||||||
void run() {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue