您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ unlock函数代码示例

51自学网 2021-06-03 09:10:52
  C++
这篇教程C++ unlock函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中unlock函数的典型用法代码示例。如果您正苦于以下问题:C++ unlock函数的具体用法?C++ unlock怎么用?C++ unlock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了unlock函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: unlock

AuthzDocumentsUpdateGuard::~AuthzDocumentsUpdateGuard() {    if (_lockedForUpdate) {        unlock();    }}
开发者ID:DavidAlphaFox,项目名称:mongodb,代码行数:5,


示例2: mprAssert

int MaClient::sendCore(char *method, char *requestUrl, char *postData, 	int postLen){	char	abuf[MPR_HTTP_MAX_PASS * 2], encDetails[MPR_HTTP_MAX_PASS * 2];	char	*host;	int		port, len, rc, nbytes;	mprAssert(requestUrl && *requestUrl);	lock();	reset();	mprLog(3, tMod, "sendCore: %s %s/n", method, requestUrl);	this->method = mprStrdup(method);	timestamp = mprGetTime(0);	if (timeoutPeriod < 0) {		timeoutPeriod = MPR_HTTP_CLIENT_TIMEOUT;	}	if (timeoutPeriod > 0) {		if (!mprGetDebugMode()) {			timer = new MprTimer(MPR_HTTP_TIMER_PERIOD, timeoutWrapper, 				(void *) this);		}	}		if (*requestUrl == '/') {		url.parse(requestUrl);		host = (proxyHost) ? proxyHost : defaultHost;		port = (proxyHost) ? proxyPort : defaultPort;	} else {		url.parse(requestUrl);		host = (proxyHost) ? proxyHost : url.host;		port = (proxyHost) ? proxyPort : url.port;	}	if (sock) {		if (port != currentPort || strcmp(host, currentHost) != 0) {			//			//	This request is for a different host or port. Must close socket.			//			sock->close(0);			sock->dispose();			sock = 0;		}	}	if (sock == 0) {		sock = new MprSocket();		mprLog(3, tMod, "Opening new socket on: %s:%d/n", host, port);		rc = sock->openClient(host, port, MPR_SOCKET_NODELAY);		if (rc < 0) {			mprLog(MPR_ERROR, tMod, "Can't open socket on %s:%d, %d/n", 				host, port, rc);			unlock();			sock->dispose();			sock = 0;			return rc;		}		sock->setBufSize(-1, MPR_HTTP_CLIENT_BUFSIZE);		currentHost = mprStrdup(host);		currentPort = port;	} else {		mprLog(3, tMod, "Reusing Keep-Alive socket on: %s:%d/n", host, port);	}	//	//	Remove this flush when pipelining is supported	//	inBuf->flush();	fd = sock->getFd();	if (proxyHost && *proxyHost) {		if (url.query && *url.query) {			outBuf->putFmt("%s http://%s:%d%s?%s HTTP/1.1/r/n",				method, proxyHost, proxyPort, url.uri, url.query);		} else {			outBuf->putFmt("%s http://%s:%d%s HTTP/1.1/r/n",				method, proxyHost, proxyPort, url.uri);		}	} else {		if (url.query && *url.query) {			outBuf->putFmt("%s %s?%s HTTP/1.1/r/n", method, url.uri, url.query);		} else {			outBuf->putFmt("%s %s HTTP/1.1/r/n", method, url.uri);		}	}	if (serverAuthType) {		if (strcmp(serverAuthType, "basic") == 0) {			mprSprintf(abuf, sizeof(abuf), "%s:%s", user, password);			maEncode64(encDetails, sizeof(encDetails), abuf);			outBuf->putFmt("Authorization: %s %s/r/n", serverAuthType, 				encDetails);#if BLD_FEATURE_DIGEST		} else if (strcmp(serverAuthType, "digest") == 0) {			char	a1Buf[256], a2Buf[256], digestBuf[256];			char	*ha1, *ha2, *digest, *qop;//.........这里部分代码省略.........
开发者ID:embedthis,项目名称:appweb-2,代码行数:101,


示例3: _find

    bool LockerImpl::saveLockStateAndUnlock(Locker::LockSnapshot* stateOut) {        // Clear out whatever is in stateOut.        stateOut->locks.clear();        stateOut->globalMode = MODE_NONE;        stateOut->globalRecursiveCount = 0;        // First, we look at the global lock.  There is special handling for this (as the flush        // lock goes along with it) so we store it separately from the more pedestrian locks.        LockRequest* globalRequest = _find(resourceIdGlobal);        if (NULL == globalRequest) {            // If there's no global lock there isn't really anything to do.            invariant(_requests.empty());            return false;        }        // If the global lock has been acquired more than once, we're probably somewhere in a        // DBDirectClient call.  It's not safe to release and reacquire locks -- the context using        // the DBDirectClient is probably not prepared for lock release.        if (globalRequest->recursiveCount > 1) {            return false;        }        // The global lock has been acquired just once.        invariant(1 == globalRequest->recursiveCount);        stateOut->globalMode = globalRequest->mode;        stateOut->globalRecursiveCount = globalRequest->recursiveCount;        // Flush lock state is inferred from the global state so we don't bother to store it.        // Next, the non-global locks.        for (LockRequestsMap::const_iterator it = _requests.begin(); it != _requests.end(); it++) {            const ResourceId& resId = it->first;            const LockRequest* request = it->second;            // This is handled separately from normal locks as mentioned above.            if (resourceIdGlobal == resId) {                continue;            }            // This is an internal lock that is obtained when the global lock is locked.            if (resourceIdMMAPV1Flush == resId) {                continue;            }            // We don't support saving and restoring document-level locks.            invariant(RESOURCE_DATABASE == resId.getType() ||                      RESOURCE_COLLECTION == resId.getType());            // And, stuff the info into the out parameter.            Locker::LockSnapshot::OneLock info;            info.resourceId = resId;            info.mode = request->mode;            info.recursiveCount = request->recursiveCount;            stateOut->locks.push_back(info);        }        // Sort locks from coarsest to finest.  They'll later be acquired in this order.        std::sort(stateOut->locks.begin(), stateOut->locks.end(), SortByGranularity());        // Unlock everything.        // Step 1: Unlock all requests that are not-flush and not-global.        for (size_t i = 0; i < stateOut->locks.size(); ++i) {            for (size_t j = 0; j < stateOut->locks[i].recursiveCount; ++j) {                unlock(stateOut->locks[i].resourceId);            }        }        // Step 2: Unlock the global lock.        for (size_t i = 0; i < stateOut->globalRecursiveCount; ++i) {            unlock(resourceIdGlobal);        }        // Step 3: Unlock flush.  It's only acquired on the first global lock acquisition        // so we only unlock it once.        invariant(unlock(resourceIdMMAPV1Flush));        return true;    }
开发者ID:BotterLiu,项目名称:mongo,代码行数:79,


示例4: USED

/* * generic single channel send/recv * if the bool pointer is nil, * then the full exchange will * occur. if pres is not nil, * then the protocol will not * sleep but return if it could * not complete. * * sleep can wake up with g->param == nil * when a channel involved in the sleep has * been closed.  it is easiest to loop and re-run * the operation; we'll see that it's now closed. */voidruntime
C++ unlockBuffer函数代码示例
C++ unload_add_on函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。