How can i monitor requests on WKWebview?

Finally I solved it Since I don’t have control over the web view content, I injected to the WKWebview a java script that include a jQuery AJAX request listener. When the listener catches a request it sends the native app the request body in the method: webkit.messageHandlers.callbackHandler.postMessage(data); The native app catches the message in a … Read more

CPU temperature monitoring

For at least the CPU side of things, you could use WMI. The namespace\object is root\WMI, MSAcpi_ThermalZoneTemperature Sample Code: ManagementObjectSearcher searcher = new ManagementObjectSearcher(“root\\WMI”, “SELECT * FROM MSAcpi_ThermalZoneTemperature”); ManagementObjectCollection collection = searcher.Get(); foreach(ManagementBaseObject tempObject in collection) { Console.WriteLine(tempObject[“CurrentTemperature”].ToString()); } That will give you the temperature in a raw format. You have to convert from there: … Read more

Is it ok to read a shared boolean flag without locking it when another thread may set it (at most once)?

It is never OK to read something possibly modified in a different thread without synchronization. What level of synchronization is needed depends on what you are actually reading. For primitive types, you should have a look at atomic reads, e.g. in the form of std::atomic<bool>. The reason synchronization is always needed is that the processors … Read more

Monitor vs lock

Eric Lippert talks about this in his blog: Locks and exceptions do not mix The equivalent code differs between C# 4.0 and earlier versions. In C# 4.0 it is: bool lockWasTaken = false; var temp = obj; try { Monitor.Enter(temp, ref lockWasTaken); { body } } finally { if (lockWasTaken) Monitor.Exit(temp); } It relies on … Read more