• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ LockList函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ReleaseAllLink

// Release all links
void ReleaseAllLink(HUB *h)
{
	LINK **kk;
	UINT num, i;
	// Validate arguments
	if (h == NULL)
	{
		return;
	}

	LockList(h->LinkList);
	{
		num = LIST_NUM(h->LinkList);
		kk = ToArray(h->LinkList);
		DeleteAll(h->LinkList);
	}
	UnlockList(h->LinkList);

	for (i = 0;i < num;i++)
	{
		LINK *k = kk[i];

		ReleaseLink(k);
	}

	Free(kk);
}
开发者ID:alex-docker,项目名称:CE-dockerfiles,代码行数:28,代码来源:Link.c


示例2: Tick64ToTime64

// Convert the Tick value to time
UINT64 Tick64ToTime64(UINT64 tick)
{
	UINT64 ret = 0;
	if (tick == 0)
	{
		return 0;
	}
	LockList(tk64->AdjustTime);
	{
		UINT i;
		for (i = 0;i < LIST_NUM(tk64->AdjustTime);i++)
		{
			ADJUST_TIME *t = LIST_DATA(tk64->AdjustTime, i);
			if (t->Tick <= tick)
			{
				ret = t->Time + (tick - t->Tick);
			}
		}
	}
	UnlockList(tk64->AdjustTime);
	if (ret == 0)
	{
		ret++;
	}
	return ret;
}
开发者ID:13eatrice,项目名称:SoftEtherVPN,代码行数:27,代码来源:Tick64.c


示例3: EtEnumDevice

// Device enumeration
UINT EtEnumDevice(EL *e, RPC_ENUM_DEVICE *t)
{
	bool is_beta_expired = ElIsBetaExpired();

	if (is_beta_expired)
	{
		// The beta version has expired
		return ERR_BETA_EXPIRES;
	}

	FreeRpcEnumDevice(t);
	Zero(t, sizeof(RPC_ENUM_DEVICE));

	LockList(e->DeviceList);
	{
		UINT i;

		t->NumItem = LIST_NUM(e->DeviceList);
		t->Items = ZeroMalloc(sizeof(RPC_ENUM_DEVICE_ITEM) * t->NumItem);

		for (i = 0;i < t->NumItem;i++)
		{
			RPC_ENUM_DEVICE_ITEM *d = &t->Items[i];
			EL_DEVICE *eld = LIST_DATA(e->DeviceList, i);

			StrCpy(d->DeviceName, sizeof(d->DeviceName), eld->DeviceName);
			d->Active = eld->Active && ((ELOG_IS_BETA || e->LicenseStatus->Valid) ? true : false);
		}
	}
	UnlockList(e->DeviceList);

	return ERR_NO_ERROR;
}
开发者ID:m-a-n-a-v,项目名称:SoftEtherVPN_Stable,代码行数:34,代码来源:EtherLog.c


示例4: LockList

// Add a Layer-3 switch
L3SW *L3AddSw(CEDAR *c, char *name)
{
	L3SW *s = NULL;
	// Validate arguments
	if (c == NULL || name == NULL)
	{
		return NULL;
	}

	LockList(c->L3SwList);
	{
		s = L3GetSw(c, name);

		if (s == NULL)
		{
			s = NewL3Sw(c, name);

			Insert(c->L3SwList, s);

			AddRef(s->ref);
		}
		else
		{
			ReleaseL3Sw(s);
			s = NULL;
		}
	}
	UnlockList(c->L3SwList);

	return s;
}
开发者ID:BIGbozi,项目名称:SoftEtherVPN,代码行数:32,代码来源:Layer3.c


示例5: Zero

// Get the L3 switch
L3SW *L3GetSw(CEDAR *c, char *name)
{
	L3SW t, *s;
	// Validate arguments
	if (c == NULL || name == NULL)
	{
		return NULL;
	}

	Zero(&t, sizeof(t));
	StrCpy(t.Name, sizeof(t.Name), name);

	LockList(c->L3SwList);
	{
		s = Search(c->L3SwList, &t);
	}
	UnlockList(c->L3SwList);

	if (s != NULL)
	{
		AddRef(s->ref);
	}

	return s;
}
开发者ID:BIGbozi,项目名称:SoftEtherVPN,代码行数:26,代码来源:Layer3.c


示例6: DeleteCa

// Delete trusted CA from Cedar
bool DeleteCa(CEDAR *cedar, UINT ptr)
{
	bool b = false;
	// Validate arguments
	if (cedar == NULL || ptr == 0)
	{
		return false;
	}

	LockList(cedar->CaList);
	{
		UINT i;

		for (i = 0;i < LIST_NUM(cedar->CaList);i++)
		{
			X *x = LIST_DATA(cedar->CaList, i);

			if (POINTER_TO_KEY(x) == ptr)
			{
				Delete(cedar->CaList, x);
				FreeX(x);

				b = true;

				break;
			}
		}
	}
	UnlockList(cedar->CaList);

	return b;
}
开发者ID:benapetr,项目名称:SoftEtherVPN,代码行数:33,代码来源:Cedar.c


示例7: AddConnection

// Add connection to Cedar
void AddConnection(CEDAR *cedar, CONNECTION *c)
{
	char tmp[MAX_SIZE];
	UINT i;
	// Validate arguments
	if (cedar == NULL || c == NULL)
	{
		return;
	}

	// Determine the name of the connection
	i = Inc(cedar->ConnectionIncrement);
	Format(tmp, sizeof(tmp), "CID-%u", i);


	Lock(c->lock);
	{
		Free(c->Name);
		c->Name = CopyStr(tmp);
	}
	Unlock(c->lock);

	LockList(cedar->ConnectionList);
	{
		Add(cedar->ConnectionList, c);
		AddRef(c->ref);
		Debug("Connection %s Inserted to Cedar.\n", c->Name);
	}
	UnlockList(cedar->ConnectionList);
}
开发者ID:benapetr,项目名称:SoftEtherVPN,代码行数:31,代码来源:Cedar.c


示例8: SoraUReleaseBuffer

VOID SoraUReleaseBuffer(PVOID Buff) {

	RELEASE_KERNEL_BUFFER_IN release_kb_in = { 0 };
	DWORD length;
	release_kb_in.Buff = Buff;

	OVERLAPPED overlap = { 0 };
	DeviceIoControl(SoraDevice, 
					UEXT_CMD(RELEASE_KERNEL_BUFFER), 
					&release_kb_in,
					sizeof(RELEASE_KERNEL_BUFFER_IN),
					NULL,
					0,
					&length,
					&overlap);

	LockList(&LockLong);
	LIST_ENTRY* entry;
	entry = AllocBufferListHead.Flink;
	while(entry != &AllocBufferListHead) {
		struct KernelBufferEntry* be;
		be = (struct KernelBufferEntry*)entry;
		if (be->AllocKBOut.Buff != Buff)
			entry = entry->Flink;
		else {
			RemoveEntryList(entry);
			delete be;
			break;
		}
	}
	UnlockList(&LockLong);
}
开发者ID:PaulJing,项目名称:Sora,代码行数:32,代码来源:_user_mode_ext.c


示例9: AcLock

// Lock the account database for the hub
void AcLock(HUB *h)
{
	// Validate arguments
	if (h == NULL)
	{
		return;
	}
	if (NO_ACCOUNT_DB(h))
	{
		return;
	}

	// Lock group list and user list
	LockList(h->HubDb->GroupList);
	LockList(h->HubDb->UserList);
}
开发者ID:AlexeyBychkov,项目名称:SoftEtherVPN,代码行数:17,代码来源:Account.c


示例10: SoraURadioTransferEx

HRESULT 
SoraURadioTransferEx(
    IN ULONG RadioNo,
    IN PVOID SampleBuffer,
    IN ULONG SampleSize,
    OUT PULONG TxID) {

	BOOL isContinuous;
	isContinuous = FALSE;
	
	LockList(&LockLong);
	
	LIST_ENTRY* entry;
	entry = AllocBufferListHead.Flink;
	while(entry != &AllocBufferListHead) {
		struct KernelBufferEntry* be;
		be = (struct KernelBufferEntry*)entry;
		if (((ULONG)SampleBuffer >= (ULONG)be->AllocKBOut.Buff) &&
			((ULONG)SampleBuffer + SampleSize <= (ULONG)be->AllocKBOut.Buff + be->Size)) {
			isContinuous = be->AllocKBOut.is_Continuous;
			break;
		}
		entry = entry->Flink;
	}
	UnlockList(&LockLong);

	if (isContinuous)
		return SoraURadioTransferContinuous(SampleBuffer,
			SampleSize,
			TxID);
	else
		return SoraURadioTransferDiscontinuous(SampleBuffer,	//  we make OS to prepare a physical continuous memory for us, the overhead is memory copy
			SampleSize,											//  it is still ok to force invoke SoraURadioTransferContinuous even if they are not physically continuous
			TxID);
}
开发者ID:PaulJing,项目名称:Sora,代码行数:35,代码来源:_user_mode_ext.c


示例11: SoraUForceAllocContinuousBufferEx

KernelBufferEntry* SoraUForceAllocContinuousBufferEx(ULONG Size) {

	ALLOC_KERNEL_BUFFER_IN alloc_kb_in;
	ALLOC_KERNEL_BUFFER_OUT alloc_kb_out = { 0 };
	DWORD length;
	alloc_kb_in.Size = Size;
	alloc_kb_in.force_Continuous = 1;

	OVERLAPPED overlap = { 0 };
	if (!DeviceIoControl(SoraDevice, 
						UEXT_CMD(ALLOC_KERNEL_BUFFER), 
						&alloc_kb_in,
						sizeof(ALLOC_KERNEL_BUFFER_IN),
						&alloc_kb_out,
						sizeof(ALLOC_KERNEL_BUFFER_OUT),
						&length,
						&overlap))
		return NULL;

	if (alloc_kb_out.Buff) {
		struct KernelBufferEntry* be;
		be = new struct KernelBufferEntry;
		be->AllocKBOut.Buff = alloc_kb_out.Buff;
		be->AllocKBOut.HiPhyBuff = alloc_kb_out.HiPhyBuff;
		be->AllocKBOut.LoPhyBuff = alloc_kb_out.LoPhyBuff;
		be->AllocKBOut.is_Continuous = alloc_kb_out.is_Continuous;
		be->Size = Size;		
		LockList(&LockLong);
		InsertHeadList(&AllocBufferListHead,
			be);
		UnlockList(&LockLong);
		return be;
	}
	return NULL;
}
开发者ID:PaulJing,项目名称:Sora,代码行数:35,代码来源:_user_mode_ext.c


示例12: DelUDPEntry

// Delete the UDP session from the UDP entry
void DelUDPEntry(CEDAR *cedar, SESSION *session)
{
	UINT num, i;
	// Validate arguments
	if (cedar == NULL || session == NULL)
	{
		return;
	}

	LockList(cedar->UDPEntryList);
	{
		num = LIST_NUM(cedar->UDPEntryList);
		for (i = 0;i < num;i++)
		{
			UDP_ENTRY *e = LIST_DATA(cedar->UDPEntryList, i);
			if (e->Session == session)
			{
				ReleaseSession(e->Session);
				Delete(cedar->UDPEntryList, e);
				Free(e);
				UnlockList(cedar->UDPEntryList);
				Debug("UDP_Entry Deleted.\n");
				return;
			}
		}
	}
	UnlockList(cedar->UDPEntryList);
}
开发者ID:1nv4d3r5,项目名称:SoftEtherVPN,代码行数:29,代码来源:Listener.c


示例13: LockList

// Get the session from the session key
SESSION *GetSessionFromUDPEntry(CEDAR *cedar, UINT key32)
{
	UDP_ENTRY *e, t;
	SESSION *s;
	// Validate arguments
	if (cedar == NULL)
	{
		return NULL;
	}

	t.SessionKey32 = key32;

	LockList(cedar->UDPEntryList);
	{
		e = Search(cedar->UDPEntryList, &t);
		if (e == NULL)
		{
			UnlockList(cedar->UDPEntryList);
			return NULL;
		}
		s = e->Session;
		AddRef(s->ref);
	}
	UnlockList(cedar->UDPEntryList);

	return s;
}
开发者ID:1nv4d3r5,项目名称:SoftEtherVPN,代码行数:28,代码来源:Listener.c


示例14: StopAllLink

// Stop all links
void StopAllLink(HUB *h)
{
	LINK **link_list;
	UINT num_link;
	UINT i;
	// Validate arguments
	if (h == NULL)
	{
		return;
	}

	LockList(h->LinkList);
	{
		link_list = ToArray(h->LinkList);
		num_link = LIST_NUM(h->LinkList);
		for (i = 0;i < num_link;i++)
		{
			AddRef(link_list[i]->ref);
		}
	}
	UnlockList(h->LinkList);

	for (i = 0;i < num_link;i++)
	{
		StopLink(link_list[i]);
		ReleaseLink(link_list[i]);
	}

	Free(link_list);
}
开发者ID:alex-docker,项目名称:CE-dockerfiles,代码行数:31,代码来源:Link.c


示例15: IsInNoSsl

// Check whether the specified IP address is in Non-SSL connection list
bool IsInNoSsl(CEDAR *c, IP *ip)
{
	bool ret = false;
	// Validate arguments
	if (c == NULL || ip == NULL)
	{
		return false;
	}

	LockList(c->NonSslList);
	{
		NON_SSL *n = SearchNoSslList(c, ip);

		if (n != NULL)
		{
			if (n->EntryExpires > Tick64() && n->Count > NON_SSL_MIN_COUNT)
			{
				n->EntryExpires = Tick64() + (UINT64)NON_SSL_ENTRY_EXPIRES;
				ret = true;
			}
		}
	}
	UnlockList(c->NonSslList);

	return ret;
}
开发者ID:benapetr,项目名称:SoftEtherVPN,代码行数:27,代码来源:Cedar.c


示例16: NullToken

// Enumerate VLANs
TOKEN_LIST *UnixVLanEnum()
{
	TOKEN_LIST *ret;
	UINT i;
	if (unix_vlan == NULL)
	{
		return NullToken();
	}

	ret = ZeroMalloc(sizeof(TOKEN_LIST));

	LockList(unix_vlan);
	{
		ret->NumTokens = LIST_NUM(unix_vlan);
		ret->Token = ZeroMalloc(sizeof(char *) * ret->NumTokens);

		for (i = 0;i < ret->NumTokens;i++)
		{
			UNIX_VLAN_LIST *t = LIST_DATA(unix_vlan, i);

			ret->Token[i] = CopyStr(t->Name);
		}
	}
	UnlockList(unix_vlan);

	return ret;
}
开发者ID:AquilesCrespo,项目名称:SoftEtherVPN,代码行数:28,代码来源:VLanUnix.c


示例17: CheckSignatureByCaLinkMode

// Check whether the certificate is signed by CA which is trusted by the hub 
bool CheckSignatureByCaLinkMode(SESSION *s, X *x)
{
	LINK *k;
	HUB *h;
	bool ret = false;
	// Validate arguments
	if (s == NULL || x == NULL)
	{
		return false;
	}

	if (s->LinkModeClient == false || (k = s->Link) == NULL)
	{
		return false;
	}

	h = k->Hub;

	if (h->HubDb != NULL)
	{
		LockList(h->HubDb->RootCertList);
		{
			X *root_cert;
			root_cert = GetIssuerFromList(h->HubDb->RootCertList, x);
			if (root_cert != NULL)
			{
				ret = true;
			}
		}
		UnlockList(h->HubDb->RootCertList);
	}

	return ret;
}
开发者ID:benapetr,项目名称:SoftEtherVPN,代码行数:35,代码来源:Cedar.c


示例18: UnixVLanDelete

// Delete the VLAN
void UnixVLanDelete(char *name)
{
	// Validate arguments
	if (name == NULL || unix_vlan == NULL)
	{
		return;
	}

	LockList(unix_vlan);
	{
		UINT i;
		UNIX_VLAN_LIST *t, tt;

		Zero(&tt, sizeof(tt));
		StrCpy(tt.Name, sizeof(tt.Name), name);

		t = Search(unix_vlan, &tt);
		if (t != NULL)
		{
			UnixCloseTapDevice(t->fd);
			Delete(unix_vlan, t);
			Free(t);
		}
	}
	UnlockList(unix_vlan);
}
开发者ID:AquilesCrespo,项目名称:SoftEtherVPN,代码行数:27,代码来源:VLanUnix.c


示例19: AddCa

// Add trusted CA to Cedar
void AddCa(CEDAR *cedar, X *x)
{
	// Validate arguments
	if (cedar == NULL || x == NULL)
	{
		return;
	}

	LockList(cedar->CaList);
	{
		UINT i;
		bool ok = true;

		for (i = 0;i < LIST_NUM(cedar->CaList);i++)
		{
			X *exist_x = LIST_DATA(cedar->CaList, i);
			if (CompareX(exist_x, x))
			{
				ok = false;
				break;
			}
		}

		if (ok)
		{
			Insert(cedar->CaList, CloneX(x));
		}
	}
	UnlockList(cedar->CaList);
}
开发者ID:benapetr,项目名称:SoftEtherVPN,代码行数:31,代码来源:Cedar.c


示例20: UnixVLanGet

// Get the VLAN
int UnixVLanGet(char *name)
{
	int fd = -1;
	// Validate arguments
	if (name == NULL || unix_vlan == NULL)
	{
		return -1;
	}

	LockList(unix_vlan);
	{
		UINT i;
		UNIX_VLAN_LIST *t, tt;

		Zero(&tt, sizeof(tt));
		StrCpy(tt.Name, sizeof(tt.Name), name);

		t = Search(unix_vlan, &tt);
		if (t != NULL)
		{
			fd = t->fd;
		}
	}
	UnlockList(unix_vlan);

	return fd;
}
开发者ID:AquilesCrespo,项目名称:SoftEtherVPN,代码行数:28,代码来源:VLanUnix.c



注:本文中的LockList函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LockMut函数代码示例发布时间:2022-05-30
下一篇:
C++ LockFileEx函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap