From ae38d0ff23d2efb4bf399a6eaf25b6dc92dd1dd4 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Wed, 1 Jun 2005 20:40:45 +0000 Subject: [PATCH] A testcase for testing multi-thread issues git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7241 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/common.mk | 1 + Examples/test-suite/threads.i | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 Examples/test-suite/threads.i diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index 3353d7f01..61fe73d13 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -273,6 +273,7 @@ CPP_TEST_CASES += \ template_typedef_ptr \ template_virtual \ template_whitespace \ + threads \ throw_exception \ typedef_array_member \ typedef_class \ diff --git a/Examples/test-suite/threads.i b/Examples/test-suite/threads.i new file mode 100644 index 000000000..7c6b09be0 --- /dev/null +++ b/Examples/test-suite/threads.i @@ -0,0 +1,23 @@ +// This test is designed for testing wrappers in the target language in a multi-threaded environment. +// The most common cause for this test failing is incorrect compiler settings for a multi-threaded environment. + +%module threads + +%include "std_string.i" + +%newobject Kerfuffle::CharString; + +%inline %{ + #include + struct Kerfuffle { + std::string StdString(std::string str) { + return str; + } + char * CharString(const char *str) { + char * retstr = new char[256]; + strcpy(retstr, str); + return retstr; + } + }; +%} +