Hi Ben,
I get the list of network adapters successfully in main thread using NetworkList API.
But I failed to get it in a second thread:
Attempted to use a required callback, but there is no attached message loop on which to run the callback.
Then, I tried to UpdateNetworkList with a Blocking CompletionCallBackWithOutput in a background thread.
I got this err : UpdateNetworkLis failed: -4
Can i UpdateNetworkList with a Blocking CallBack?
Can you help me to find out the invalid argument?
Looking forward to your reply.
@code
Class XXXInstance : public pp::Instance()
{
public:
explicit XXXInstance(PP_Instance instance)
: pp::instance(instance)
, m_callBack(m_storageType)
, m_networkMonitor(this){}
void update();
private:
pp::internal::CallbackOutputTraits<pp::NetworkList>::StorageType *m_storageType;
pp::CompletionCallBackWithOutput<pp::NetworkList> m_callBack;
pp::NetworkMonitor m_networkMonitor;
};
void update()
{
int32_t result = m_networkMonitor.UpdateNetworkList(m_callBack);
if (result != PP_OK_COMPLETIONPENDING)
{
std::ostringstream status;
status<< "UpdateNetworkLis failed: "<< result;
PostMessage(status.str());
}
}
@endcode
Thanks
在 2016年4月19日星期二 UTC+8上午5:23:25,Ben Smith写道: