本文整理汇总了C++中DeleteLock函数的典型用法代码示例。如果您正苦于以下问题:C++ DeleteLock函数的具体用法?C++ DeleteLock怎么用?C++ DeleteLock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DeleteLock函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int
main()
{
int lock3,mv3,cv3;
lock3 = CreateLock("lock3",5);
cv3 = CreateCV("cv3",3);
mv3 = CreateMV("mv3",3,5);
WriteToConsole("\nAcquiring lock3 in rpcclient5\n\0", -1, -1, -1);
if((Acquire("lock3",5)) == -1){
WriteToConsole("Error acquiring lock3 in rpcclient5\n\0",-1,-1,-1);
Exit(0);
}
if((Wait("cv3",3, "lock3",5)) == -1){
WriteToConsole("Error waiting on cv3 and lock3 in rpcClient1\n\0",-1,-1,-1);
Exit(0);
}
WriteToConsole("\nGot Signal on cv3 lock3 from rpcClient1\n\0", -1, -1, -1);
WriteToConsole("\nValue of mv3 index 3 set by rpcClient1 is %d\n\0", GetMV("mv3",3,3), -1, -1);
Release("lock3",5);
DeleteLock("lock3",5);
WriteToConsole(" Deleted Lock3\n\0",-1,-1,-1);
DeleteMV("mv3",3);
WriteToConsole(" Deleted MV3\n\0",-1,-1,-1);
DeleteCV("cv3",3);
WriteToConsole(" Deleted CV3\n\0",-1,-1,-1);
Exit(0);
}
示例2: NiFreeNat
// Release the NAT
void NiFreeNat(NAT *n)
{
// Validate arguments
if (n == NULL)
{
return;
}
// Complete management command
//NiFreeAdminAccept(n);
// Stop if the virtual host is running
Lock(n->lock);
{
if (n->Virtual != NULL)
{
StopVirtualHost(n->Virtual);
ReleaseVirtual(n->Virtual);
n->Virtual = NULL;
}
}
Unlock(n->lock);
// Release the settings
NiFreeConfig(n);
// Delete the object
ReleaseCedar(n->Cedar);
ReleaseEvent(n->HaltEvent);
DeleteLock(n->lock);
Free(n);
}
示例3: finish_segmgr
/*
* End segment manager
*/
EXPORT ER finish_segmgr( void )
{
ER ercd, ret = E_OK;
/* Finish system exception manager */
ercd = finish_excmgr();
if ( ercd < E_OK ) {
ret = ercd;
}
/* Delete subsystem registration */
ercd = tk_def_ssy(SEG_SVC, NULL);
if ( ercd < E_OK ) {
ret = ercd;
}
/* Remove segment manager lock */
DeleteLock(&SegLock);
#ifdef DEBUG
if ( ret < E_OK ) {
TM_DEBUG_PRINT(("finish_segmgr ercd = %d\n", ret));
}
#endif
return ret;
}
示例4: FOREACH_FIRST
void ShardLockManager::OnRemoveCachedLocks()
{
uint64_t now;
ShardLock* lock;
now = EventLoop::Now();
FOREACH_FIRST(lock, lockCacheList)
{
// should be unlocked
ASSERT(!lock->locked);
// session should be NULL
ASSERT(lock->session == NULL);
// not in lock expiry list
ASSERT(lock->listExpiryNode.next == lock);
// not in lock pool list
ASSERT(lock->listPoolNode.next == lock);
// in tree
ASSERT(lock->treeNode.IsInTree());
if (lock->unlockTime < now || lockCacheList.GetLength() > maxCacheCount)
{
lockTree.Remove(lock);
lockCacheList.Remove(lock);
DeleteLock(lock);
}
else
break;
}
示例5: CleanupL3Sw
// Clean-up the L3 switch
void CleanupL3Sw(L3SW *s)
{
UINT i;
// Validate arguments
if (s == NULL)
{
return;
}
for (i = 0;i < LIST_NUM(s->IfList);i++)
{
L3IF *f = LIST_DATA(s->IfList, i);
Free(f);
}
ReleaseList(s->IfList);
for (i = 0;i < LIST_NUM(s->TableList);i++)
{
L3TABLE *t = LIST_DATA(s->TableList, i);
Free(t);
}
ReleaseList(s->TableList);
DeleteLock(s->lock);
Free(s);
}
示例6: CleanupUser
// Cleanup the user object
void CleanupUser(USER *u)
{
// Validate arguments
if (u == NULL)
{
return;
}
DeleteLock(u->lock);
Free(u->Name);
Free(u->RealName);
Free(u->Note);
Free(u->GroupName);
if (u->Group != NULL)
{
ReleaseGroup(u->Group);
}
// Free authntication data
FreeAuthData(u->AuthType, u->AuthData);
if (u->Policy)
{
// Free policy data
Free(u->Policy);
}
FreeTraffic(u->Traffic);
Free(u);
}
示例7: FreeDynamicListener
// Release the dynamic listener
void FreeDynamicListener(DYNAMIC_LISTENER *d)
{
// Validate arguments
if (d == NULL)
{
return;
}
Lock(d->Lock);
{
if (d->Listener != NULL)
{
StopListener(d->Listener);
ReleaseListener(d->Listener);
d->Listener = NULL;
}
}
Unlock(d->Lock);
ReleaseCedar(d->Cedar);
DeleteLock(d->Lock);
Free(d);
}
示例8: main
void main()
{
int lck1,cv1;
Print("\nTC1_1 :: Checking Correct Working of Creating & Deleting of Locks and CV.\n",1,1,1);
lck1 = CreateLock("lock1", 5);
Print("\nTC1_1 :: Lock name 'lock1' Created. The Index is '%d'.\n",lck1,1,1);
cv1 = CreateCV("cv1", 3);
Print("\nTC1_1 :: CV name 'cv1' Created. The Index is '%d'.\n",cv1,1,1);
Acquire(lck1);
Print("\nTC1_1 :: Going on wait on 'cv1' using 'lock1'. Now run the 'tc1_2' file.\n",1,1,1);
Wait(cv1,lck1);
Print("\nTC1_1 :: Have been signalled on 'cv1' using 'lock1'.\n",1,1,1);
Release(lck1);
DeleteCV(cv1);
DeleteLock(lck1);
Print("\nTC1_1 :: Reached end.\n",lck1,1,1);
Exit(0);
}
示例9: FreeTick64
// Release of the Tick64
void FreeTick64()
{
UINT i;
if (tk64 == NULL)
{
// Uninitialized
return;
}
// Termination process
tk64->Halt = true;
Set(halt_tick_event);
WaitThread(tk64->Thread, INFINITE);
ReleaseThread(tk64->Thread);
// Releasing process
for (i = 0;i < LIST_NUM(tk64->AdjustTime);i++)
{
ADJUST_TIME *t = LIST_DATA(tk64->AdjustTime, i);
Free(t);
}
ReleaseList(tk64->AdjustTime);
DeleteLock(tk64->TickLock);
Free(tk64);
tk64 = NULL;
ReleaseEvent(halt_tick_event);
halt_tick_event = NULL;
}
示例10: main
void main()
{
int lck1,cv1;
Print("\nTC1_2 :: Checking Correct Working of Creating & Deleting of Locks and CV.\n",1,1,1);
lck1 = CreateLock("lock1", 5);
Print("\nTC1_2 :: Lock name 'lock1' Created. The Index is '%d'.\n",lck1,1,1);
cv1 = CreateCV("cv1", 3);
Print("\nTC1_2 :: CV name 'cv1' Created. The Index is '%d'.\n",cv1,1,1);
Acquire(lck1);
Print("\nTC1_2 :: Going to signal on 'cv1'. The waiter on 'cv1' will be woken up.\n",1,1,1);
Signal(cv1,lck1);
Release(lck1);
DeleteCV(cv1);
DeleteLock(lck1);
Print("\nTC1_2 :: Reached end.\n",lck1,1,1);
Exit(0);
}
示例11: CloseSec
// Close the secure device
void CloseSec(SECURE *sec)
{
// Validate arguments
if (sec == NULL)
{
return;
}
// Log out
LogoutSec(sec);
// Close the session
CloseSecSession(sec);
// Release the token information
FreeSecInfo(sec);
// Release of the slot list memory
if (sec->SlotIdList != NULL)
{
Free(sec->SlotIdList);
sec->SlotIdList = NULL;
}
// Unload the module
FreeSecModule(sec);
// Memory release
DeleteLock(sec->lock);
Free(sec);
}
示例12: main
void main()
{
int lck1,cv1=-1,lck2;
Print("\nTC5_1 :: Checking Working of Wait and Signal. \n",1,1,1);
lck1 = CreateLock("lock1", 5);
Print("\nTC5_1 :: Lock name 'lock1' Created. The Index is '%d'.\n",lck1,1,1);
Acquire(lck1);
Print("\nTC5_1 :: Going on wait on 'cv1' that is not created using 'lock1'. Will not go on wait.\n",1,1,1);
Wait(cv1,lck1);
Print("\nERROR - TC5_1 :: Could not go on wait on 'cv1' using 'lock1'.\n",1,1,1);
cv1 = CreateCV("cv1", 3);
Print("\nTC5_1 :: CV name 'cv1' Created. The Index is '%d'.\n",cv1,1,1);
Print("\nTC5_1 :: Going on wait on 'cv1' that is now created using 'lock1'. Now run the 'tc5_2' file.\n",1,1,1);
Wait(cv1,lck1);
Print("\nTC5_1 :: Have been signalled on 'cv1' using 'lock1'.\n",1,1,1);
Release(lck1);
DeleteCV(cv1);
DeleteLock(lck1);
Print("\nTC5_1 :: Reached end.\n",lck1,1,1);
Exit(0);
}
示例13: main
void main()
{
int lck1,cv1,lck2;
Print("\nTC6_1 :: Checking Working of Wait and Signal. \n",1,1,1);
lck1 = CreateLock("lock1", 5);
Print("\nTC6_1 :: Lock name 'lock1' Created. The Index is '%d'.\n",lck1,1,1);
cv1 = CreateCV("cv1", 3);
Print("\nTC6_1 :: CV name 'cv1' Created. The Index is '%d'.\n",cv1,1,1);
Acquire(lck1);
Print("\nTC6_1 :: Going on wait on 'cv1' using 'lock1' that is the correct lock (First Waiter). Will go on wait. Now run the 'tc6_2' file. \n",1,1,1);
Wait(cv1,lck1);
Print("\nTC6_1 :: Have been Signalled on 'cv1' using 'lock2'.\n",1,1,1);
Release(lck1);
DeleteCV(cv1);
DeleteLock(lck1);
Print("\nTC6_1 :: Reached end.\n",lck1,1,1);
Exit(0);
}
示例14: NiFreeNat
// NAT の解放
void NiFreeNat(NAT *n)
{
// 引数チェック
if (n == NULL)
{
return;
}
// 管理コマンド終了
//NiFreeAdminAccept(n);
// 仮想ホストが動作中の場合は停止
Lock(n->lock);
{
if (n->Virtual != NULL)
{
StopVirtualHost(n->Virtual);
ReleaseVirtual(n->Virtual);
n->Virtual = NULL;
}
}
Unlock(n->lock);
// 設定の解放
NiFreeConfig(n);
// オブジェクトの削除
ReleaseCedar(n->Cedar);
ReleaseEvent(n->HaltEvent);
DeleteLock(n->lock);
Free(n);
}
示例15: dt_main
/*
* Calendar functions entry
*/
EXPORT ER dt_main(INT ac, UB* av[])
{
ER er;
T_DSSY dssy;
if (ac < 0) {
/* Stop other tasks from executing SVC */
Lock(&dtLock);
/* Unregister subsystem */
tk_def_ssy(DT_SVC, NULL);
/* Delete lock */
DeleteLock(&dtLock);
return E_OK;
}
/* Create lock */
er = CreateLock(&dtLock, "dtLk");
if (er < E_OK) {
goto err_ret0;
}
/* Register subsystem */
dssy.ssyatr = TA_NULL;
dssy.ssypri = DT_PRI;
dssy.svchdr = (FP)svcEntry;
dssy.breakfn = NULL;
dssy.startupfn = NULL;
dssy.cleanupfn = NULL;
dssy.eventfn = NULL;
dssy.resblksz = 0;
er = tk_def_ssy(DT_SVC, &dssy);
if (er < E_OK) {
goto err_ret1;
}
return E_OK;
err_ret1:
DeleteLock(&dtLock);
err_ret0:
return er;
}