William S Fulton
aef97a5783
Cosmetic tidyup in SWIG_JAVA_DETACH_ON_THREAD_END code
2022-05-28 10:22:34 +01:00
Joachim Kuebart
36dc81808b
Java: Move auxiliary methods into JObjectWrapper.
2022-05-24 14:34:09 +02:00
Joachim Kuebart
b58c554cde
Java: Option to detach from the JVM in the thread destructor.
2022-05-23 17:17:18 +02:00
William S Fulton
b018c32f9d
Fix crashes in swig_connect_director during director class construction.
...
Occurs when using the director class from multiple threads - a race condition
initialising block scope static variables.
Block scope static variables are guaranteed to be thread safe in C++11,
so the fix is guaranteed when using C++11. However, most modern compilers
also fix it when using C++03/C++98.
Closes #1862
2020-08-28 18:23:47 +01:00
William S Fulton
5a388863fa
director_thread test fixes for MacOS
...
Add extra debugging and correctly detect MacOS using __APPLE__ macro
2018-12-21 19:08:15 +00:00
William S Fulton
f948a756bb
Increased Java thread name size.
...
MacOS thread_info.h can handle thread names up to 64 characters.
See issue #1334 .
2018-12-20 21:21:54 +00:00
William S Fulton
3195c3e4da
Java directors - more generic thread name setting
...
Activated if a user sets SWIG_JAVA_USE_THREAD_NAME.
Implementations provided for linux/android/macos/unix.
A user's implementation will be used if SWIG_JAVA_GET_THREAD_NAME is
defined. It must implement the function:
namespace Swig {
SWIGINTERN int GetThreadName(char *name, size_t len);
}
2018-10-08 21:38:41 +01:00
Sam Hasinoff
989f4289c1
Use prctl method to get thread names, which is available on all NDK versions
2018-10-08 21:24:34 +01:00
Sam Hasinoff
8dd8634420
Actually, pthread_getname_np is only available in recent versions of Android (API level >= 26).
2018-10-08 21:24:34 +01:00
Sam Hasinoff
07268b8da6
Set thread name when attaching to Android JVM in SWIG Java director
...
Otherwise the native thread name gets clobbered with "Thread-XX", which
makes debugging hard. This issue seems to be specific to the Android JVM.
Someone proposed a similar fix to SWIG:
https://github.com/swig/swig/pull/831
but abandoned it.
2018-10-08 21:24:34 +01:00
William S Fulton
901f8357b0
Replace DirectorException::raiseJavaException with DirectorException::throwException
...
This is part of a plan to provide a common DirectorException api for
throwing the target language exception raised during a director method call.
2017-11-29 20:32:15 +00:00
William S Fulton
406c7a732a
Add Swig::DirectorException directorthrows typemap for Java
...
For use with a global %catches(Swig::DirectorException)
2017-11-29 20:32:15 +00:00
William S Fulton
077bb0b04f
Improved Java director exceptions documentation
2017-11-16 20:03:58 +00:00
William S Fulton
7aa28e37ec
Java director exception handling improvements
...
When a director method throws an exception and it is caught by DirectorException
and passed back to Java using DirectorException::raiseJavaException, the Java
stack trace now contains the original source line that threw the exception.
Director exception handling code improved slightly to add some missing
ExceptionClear calls before calling JNI code.
2017-11-10 19:50:22 +00:00
William S Fulton
07ab80b49e
Add raise methods for throwing c++ exceptions in C#, Java, D
...
The director c++ exceptions are thrown in a helper method instead of in
the director overloaded method. This circumvents compiler warnings about
throwing exceptions when the method has an exception specification or
noexcept. If the exception is thrown, abort will still be called!
In Java, the "director:noexcept" typemap can be used to do something
else. This typemap should be ported to the other languages too.
2017-05-13 17:01:15 +01:00
William S Fulton
c7da8bb06e
Warning fixes in generated Java code for 64bit Visual C++ on Windows.
2015-07-03 20:59:24 +01:00
Olly Betts
e796ecaa23
Fix swapped parameters in memset call
2015-05-12 14:20:11 +12:00
William S Fulton
775afd3579
Refactor Java director swig_override array code
...
Remove code duplication: Use new Swig::BoolArray to replace multiple
instances of ZeroedBoolArray.
Refactors #403 and #413 .
2015-05-10 11:40:42 +01:00
William S Fulton
25b48b85ec
Fix multiple definitions of 'ExceptionMatches' when using directors and multiple modules.
...
Java problem, closes #353 and closes #355 .
2015-04-11 22:51:29 +01:00
William S Fulton
2f5bf397ae
Make more use of LocalRefGuard in Java
2014-09-27 13:56:11 +01:00
Pingan Yi
f38f6371a3
fixup! Patch of http://sourceforge.net/p/swig/mailman/message/29816385
2014-08-13 16:14:57 +08:00
Pingan Yi
b79646ce4c
Patch of http://sourceforge.net/p/swig/mailman/message/29816385
2014-05-04 19:10:44 +08:00
William S Fulton
cc650e692e
Director exceptions now derive from std::exception
2014-01-20 19:40:52 +00:00
William S Fulton
1a19451c1b
Error out attempting to use directors without -c++
...
Remove redundant #ifdef __cplusplus markers in director.swg
2013-12-23 20:23:54 +00:00
William S Fulton
135a7cc558
Beautify director.swg files
...
Also some comment corrections for Perl
2013-12-23 19:50:41 +00:00
William S Fulton
e7a6be289e
Rework the director.swg changes for director exception handling
...
- More robust implementation.
- Fix some bugs to give better exception messages when a user uses the
director utility exception functions and classes.
- Replace unnecessarily shortened variable names for easier reading of
code.
2013-11-07 22:51:35 +00:00
William S Fulton
fdc1772e38
Cosmetics/code style conformance in newly added Java director exception handling
2013-11-07 22:51:34 +00:00
Marvin Greenberg
6736e74127
Add feature director:except for improved director exception handling in Java
...
Closes #91
2013-10-22 20:44:35 +01:00
William S Fulton
d1bc8b5b21
Add caveat emptor for peek method in Java directors
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13838 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-09-13 19:18:25 +00:00
William S Fulton
863c25f9b8
Possibly incorrect DeleteGlobalRef call on a weak global reference in Java directors - patch from Marvin Greenberg
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13837 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-09-13 19:05:25 +00:00
William S Fulton
b38722e8ee
Apply patch for Java to fix direct use of a weak global reference in directors sometimes causing seg faults especially on Android.
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13834 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-09-13 19:02:02 +00:00
William S Fulton
d9670b608e
Fix directors for Android and improve thread attachment/detachment in multi threading environments
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12868 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-12-10 15:00:35 +00:00
William S Fulton
4308dd03cf
SWIG license change - The Examples and Lib move to a very permissive license in the LICENSE file, removing the BSD license restrictions as agreed by committers since it was inadvertently introduced. Remove some examples where the impact of the license change is not clear.
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11874 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-02-27 23:26:02 +00:00
William S Fulton
a1590359c9
Another fix for the JVM hanging on exit problem when using directors
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10550 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-06-22 00:09:11 +00:00
William S Fulton
07bdd8bd18
Fix #1632625 - Compilation errors on Visual C++ 6 when using directors
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10192 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-12-12 20:42:14 +00:00
William S Fulton
fd851b9380
Add DetachCurrentThread back in for directors. The problems occuring on Solaris look like they were jdk bugs (1.4.2 and older)
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9983 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-10-12 21:40:01 +00:00
William S Fulton
5f3de79560
Remove DetachCurrentThread patch from 08/11/2006 - it causes segfaults on some systems
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9553 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-11-13 22:15:53 +00:00
William S Fulton
e236e10bf7
Fix for directors and non jvm created threads - the jvm would not close
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9245 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-08-11 22:41:12 +00:00
William S Fulton
bdd7a81053
minor code consistent style changes
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9002 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-03-11 00:06:45 +00:00
William S Fulton
49be05f4fd
Common template for head of each file detailing licence, distribution and authors information
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8973 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-03-07 00:14:10 +00:00
William S Fulton
dec7f07eb1
jweak cast fix
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7437 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-09-13 21:03:01 +00:00
William S Fulton
94e6c86d06
Fixes to remove "dereferencing type-punned pointer will break strict-aliasing rules" warnings in C wrappers when compiling C code with 'gcc -Wall -fstrict-aliasing'. Patch from Michael Cahill.
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7192 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-05-13 23:14:35 +00:00
William S Fulton
c2e9c01ab1
Scott Michel director patch, typemap consolidation
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7174 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-04-28 22:11:06 +00:00
William S Fulton
17f65da214
Modifications to the typemaps giving users fine control over memory ownership and lifetime of director classes. Patch from Scott Michel.
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7070 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-03-15 21:31:31 +00:00
William S Fulton
deaf8c681f
new directorconnect and directorconnect_derived typemaps
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6840 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-12-07 23:04:54 +00:00
William S Fulton
3ddde9fe70
Director tweaks from Scott Michel.
...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5165 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-09-26 20:40:49 +00:00
William S Fulton
f4fac221fa
- Compliance with ISO/IEC 14882:1998(E) 17.4.3.1.2 -> eg double underscores removed
...
- Potential member variable and method name clashes remove by preceding with 'swig'
- consistent use of C++ booleans for the swig_disown flag across and within the modules that use this it in director code.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5139 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-09-22 22:55:17 +00:00
William S Fulton
9da574aae9
__DIRECTOR__ renamed Swig::Director
...
SWIG_DIRECTOR_EXCEPTION renamed Swig::DirectorException (similarly for derived classes)
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5138 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-09-22 20:13:42 +00:00
William S Fulton
eeca9ccf6a
directorin typemap renamed javadirectorin
...
directorout typemap renamed javadirectorout
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5135 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-09-20 16:13:19 +00:00
William S Fulton
a7933a75b0
First round of director mods
...
- Removed asserts
- The unused __DIRECTOR__ base class default constructor removed. I've used the conventional approach of having no default constructor rather than a private one (declaring it private doesn't serve any useful purpose when this constructor is not wanted).
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5132 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-09-20 15:11:38 +00:00