Added CAPIs for C# thread handling