本文整理汇总了C++中Owned::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ Owned::Release方法的具体用法?C++ Owned::Release怎么用?C++ Owned::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Owned
的用法示例。
在下文中一共展示了Owned::Release方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeStringException
CBaseSecurityManager::CBaseSecurityManager(const char *serviceName, const char *config)
{
Owned<IPropertyTree> cfg = createPTreeFromXMLString(config, ipt_caseInsensitive);
if(cfg.get() == NULL)
throw MakeStringException(-1, "createPTreeFromXMLString() failed for %s", config);
init(serviceName,cfg);
cfg->Release();
}
示例2: notifySelected
bool CHttpProtocol::notifySelected(ISocket *sock,unsigned selected, IPersistentHandler* persistentHandler, bool shouldClose)
{
try
{
char name[256];
int port = sock->name(name, 255);
CEspApplicationPort *apport = queryApplicationPort(port);
if(apport == NULL)
throw MakeStringException(-1, "binding not found!");
if(apport != NULL)
{
Owned<ISocket> accepted;
if (persistentHandler == nullptr)
accepted.setown(sock->accept());
else
accepted.set(sock);
if (accepted.get() != NULL)
{
char peername[256];
int port = accepted->peer_name(peername, 256);
#if defined(_DEBUG)
DBGLOG("HTTP connection from %s:%d on %s socket", peername, port, persistentHandler?"persistent":"new");
#endif
if(m_maxConcurrentThreads > 0)
{
// Using Threading pool instead of generating one thread per request.
void ** holder = new void*[7];
holder[0] = (void*)(accepted.getLink());
holder[1] = (void*)apport;
int maxEntityLength = getMaxRequestEntityLength();
holder[2] = (void*)&maxEntityLength;
bool useSSL = false;
holder[3] = (void*)&useSSL;
ISecureSocketContext* ctx = NULL;
holder[4] = (void*)ctx;
holder[5] = (void*)persistentHandler;
holder[6] = (void*)&shouldClose;
try
{
http_thread_pool->start((void*)holder, "", m_threadCreateTimeout > 0?m_threadCreateTimeout*1000:0);
}
catch(...)
{
IERRLOG("Error starting thread from http thread pool.");
if(accepted.get())
{
accepted->close();
//Assumption here is that if start() throws exception, that means the new
//thread hasn't been started, so there's no other thread holding a link.
CInterface* ci = dynamic_cast<CInterface*>(accepted.get());
if(ci && ci->IsShared())
accepted->Release();
}
delete [] holder;
throw;
}
delete [] holder;
}
else
{
/* create one thread per request */
CHttpThread *workthread = new CHttpThread(accepted.getLink(), apport, CEspProtocol::getViewConfig(), false, nullptr, persistentHandler);
workthread->setMaxRequestEntityLength(getMaxRequestEntityLength());
workthread->setShouldClose(shouldClose);
workthread->start();
workthread->Release();
}
}
}
else
{
throw MakeStringException(-1, "can't acquire bindings IEspHttpBinding interface (via dynamic_cast)!");
}
}
catch (IException *e)
{
StringBuffer estr;
IERRLOG("Exception(%d, %s) in CHttpProtocol::notifySelected()", e->errorCode(), e->errorMessage(estr).str());
e->Release();
}
catch(...)
{
IERRLOG("Unknown Exception in CHttpProtocol::notifySelected()");
}
return false;
}