Here's my problem: I have an unmanaged dll that I made.I'm calling one of this dll's functions in my C# code, using PInvoke. Under certain conditions, in the dll function, I want to be able to terminate the thread that is running the function.How would I achieve that?
Sorry if it is a stupid question, but I'm a total noob when it comes to threading:)
Man, that sounds dangerous. Why terminate the thread? You might be in a thread you don't own depending on how you're marshalling the call. Either ways, it seems like your best option is to return something to indicate you want to terminate the thread and have the managed code handle it gracefully. Don't try to kill the thread in native code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With