SWIG C# thread safety

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

SWIG C# thread safety

Jeremy Cowles
Are Swig bindings thread safe?

Reading the docs, it's a bit vague, but it sounds like the only concerns are with the C++ run-time.

--
Jeremy

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SWIG C# thread safety

Jeremy Cowles
FYI, I'm asking because it looks like thread-safe types in C++ are causing memory errors when passed between threads in C# -- specifically if the object goes out of scope; long-lived objects seem fine.

Also, yes, all libs are compiled with /MD and the types are built to be thread safe, explicitly.



On Sat, Jun 10, 2017 at 7:24 PM, Jeremy Cowles <[hidden email]> wrote:
Are Swig bindings thread safe?

Reading the docs, it's a bit vague, but it sounds like the only concerns are with the C++ run-time.

--
Jeremy


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SWIG C# thread safety

William S Fulton
There are different levels of thread-safety, but the generated code aims to not make the C++ layer any less thread-safe. You may have more of a garbage collection and lifetime issue. If as far as the managed world goes, an object has gone out of scope, it will be gc'd even though it may still be in use in the C++ world. Also make sure your destructors are fully thread-safe.

William

On 11 June 2017 at 05:29, Jeremy Cowles <[hidden email]> wrote:
FYI, I'm asking because it looks like thread-safe types in C++ are causing memory errors when passed between threads in C# -- specifically if the object goes out of scope; long-lived objects seem fine.

Also, yes, all libs are compiled with /MD and the types are built to be thread safe, explicitly.



On Sat, Jun 10, 2017 at 7:24 PM, Jeremy Cowles <[hidden email]> wrote:
Are Swig bindings thread safe?

Reading the docs, it's a bit vague, but it sounds like the only concerns are with the C++ run-time.

--
Jeremy


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Loading...