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

C++ LockMutex函数代码示例

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

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



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

示例1: signal

void *FXTerminal::worker_thread(void *arg)
#endif
{
    signal(SIGINT, sigint_handler);
#ifdef SIGBREAK
    signal(SIGBREAK, sigbreak_handler);
#endif
    term = (FXTerminal *)arg;

// set proper initial state for all the locks.
    LockMutex(term->mutex1);
    LockMutex(term->mutex2);
    term->sync_even = 1;

// run the application code.
    returncode = (*fwin_main1)(term->argc, term->argv);
    wake_up_terminal(WORKER_EXITING);
#ifdef WIN32
    ExitThread(returncode);
    return returncode;
#else
    pthread_exit(&returncode);      // between these two lines I think
    return &returncode;             // I must certainly exit!
#endif
}
开发者ID:nilqed,项目名称:ReduceAlgebra,代码行数:25,代码来源:FXWorker.cpp


示例2: TFB_DrawImage_SetMipmap

void
TFB_DrawImage_SetMipmap (TFB_Image *img, TFB_Image *mmimg, int hotx, int hoty)
{
	bool imgpal;
	bool mmpal;

	if (!img || !mmimg)
		return;

	LockMutex (img->mutex);
	LockMutex (mmimg->mutex);
	
	// Either both images must be using the same colormap, or mipmap image
	// must not be paletted. This restriction is due to the current
	// implementation of fill-stamp, which replaces the palette with
	// fill color.
	imgpal = TFB_DrawCanvas_IsPaletted (img->NormalImg);
	mmpal = TFB_DrawCanvas_IsPaletted (mmimg->NormalImg);
	if (!mmpal || (mmpal && imgpal &&
			img->colormap_index == mmimg->colormap_index))
	{
		img->MipmapImg = mmimg->NormalImg;
		img->MipmapHs.x = hotx;
		img->MipmapHs.y = hoty;
	}
	else
	{
		img->MipmapImg = NULL;
	}

	UnlockMutex (mmimg->mutex);
	UnlockMutex (img->mutex);
}
开发者ID:Serosis,项目名称:UQM-MegaMod,代码行数:33,代码来源:tfb_draw.c


示例3: Imo2sproxy_Loop

static void Imo2sproxy_Loop(IMO2SPROXY *hInst)
{
	struct sockaddr_in sock;
	int socklen;
	SOCKET new_fd;
	TYP_LIST *hConns = List_Init(32);
	CONNINST *pInst;
	IMO2SPROXY_INST *hProxy = (IMO2SPROXY_INST*)hInst;
	fd_set fdListen;

	if (hProxy->pCfg->bVerbose && hProxy->pCfg->fpLog)
		fprintf (hProxy->pCfg->fpLog, "Socksproxy:Loop(Start)\n");
	hProxy->iRunning = 1;
	LockMutex(hProxy->loopmutex);
	while (hProxy->iRunning)
	{
		FD_ZERO(&fdListen);
		FD_SET(hProxy->listen_fd, &fdListen);
		socklen = sizeof(sock);
		if (select (0, &fdListen, NULL, NULL, NULL) != SOCKET_ERROR && FD_ISSET(hProxy->listen_fd, &fdListen))
		{
			new_fd = accept(hProxy->listen_fd, (struct sockaddr *) &sock, &socklen); 
			if (hProxy->pCfg->bVerbose && hProxy->pCfg->fpLog)
			{
				fprintf (hProxy->pCfg->fpLog, "Connection from %s:%d -> Connection: %d\n", inet_ntoa(sock.sin_addr),
					ntohs(sock.sin_port), new_fd);
				fflush (hProxy->pCfg->fpLog);
			}
			if (new_fd != INVALID_SOCKET && (pInst = calloc (1, sizeof(CONNINST))))
			{
				CleanConnections (hConns);
				List_Push(hConns, pInst);
				pInst->hSock = new_fd;
				pInst->hProxy = hProxy;
				InitMutex(pInst->connected);
				LockMutex(pInst->connected);
				InitMutex(pInst->sendmutex);
				Dispatcher_Start(pInst);
			}
		}
	}
	if (hProxy->pCfg->bVerbose && hProxy->pCfg->fpLog)
		fprintf (hProxy->pCfg->fpLog, "Socksproxy:Loop(End)\n");

	CleanConnections (hConns);
	while (pInst=List_Pop(hConns))
	{
		Dispatcher_Stop(pInst);
		FreeConnection(pInst);
		free (pInst);
	}
	List_Exit(hConns);
	UnlockMutex(hProxy->loopmutex);
}
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:54,代码来源:socksproxy.c


示例4: TFB_DrawImage_CopyRect

void
TFB_DrawImage_CopyRect (TFB_Image *source, const RECT *srcRect,
		TFB_Image *target, POINT dstPt)
{
	LockMutex (source->mutex);
	LockMutex (target->mutex);
	TFB_DrawCanvas_CopyRect (source->NormalImg, srcRect,
			target->NormalImg, dstPt);
	target->dirty = TRUE;
	UnlockMutex (target->mutex);
	UnlockMutex (source->mutex);
}
开发者ID:Serosis,项目名称:UQM-MegaMod,代码行数:12,代码来源:tfb_draw.c


示例5: DoSaveTeam

BOOLEAN
DoSaveTeam (MELEE_STATE *pMS)
{
	STAMP MsgStamp;
	char file[NAME_MAX];
	uio_Stream *stream;
	CONTEXT OldContext;
	bool saveOk = false;

	snprintf (file, sizeof file, "%s.mle",
			MeleeSetup_getTeamName (pMS->meleeSetup, pMS->side));

	LockMutex (GraphicsLock);
	OldContext = SetContext (ScreenContext);
	ConfirmSaveLoad (&MsgStamp);
			// Show the "Saving . . ." message.
	UnlockMutex (GraphicsLock);

	stream = uio_fopen (meleeDir, file, "wb");
	if (stream != NULL)
	{
		saveOk = (MeleeTeam_serialize (&pMS->meleeSetup->teams[pMS->side],
				stream) == 0);
		uio_fclose (stream);

		if (!saveOk)
			uio_unlink (meleeDir, file);
	}

	pMS->load.top = 0;
	pMS->load.cur = 0;

	// Undo the screen damage done by the "Saving . . ." message.
	LockMutex (GraphicsLock);
	DrawStamp (&MsgStamp);
	DestroyDrawable (ReleaseDrawable (MsgStamp.frame));
	SetContext (OldContext);
	UnlockMutex (GraphicsLock);

	if (!saveOk)
		SaveProblem ();

	// Update the team list; a previously existing team may have been
	// deleted when save failed.
	LoadTeamList (pMS);
	SelectTeamByFileName (pMS, file);
	
	return (stream != 0);
}
开发者ID:jurchik,项目名称:project6014,代码行数:49,代码来源:loadmele.c


示例6: arith_frame_blit

void arith_frame_blit (FRAME srcFrame, const RECT *rsrc, FRAME dstFrame,
		const RECT *rdst, int num, int denom)
{
	TFB_Image *srcImg, *dstImg;
	SDL_Surface *src, *dst;
	SDL_Rect srcRect, dstRect, *srp = NULL, *drp = NULL;
	srcImg = srcFrame->image;
	dstImg = dstFrame->image;
	LockMutex (srcImg->mutex);
	LockMutex (dstImg->mutex);
	src = (SDL_Surface *)srcImg->NormalImg;
	dst = (SDL_Surface *)dstImg->NormalImg;
	if (rdst)
	{
		dstRect.x = rdst->corner.x;
		dstRect.y = rdst->corner.y;
		dstRect.w = rdst->extent.width;
		dstRect.h = rdst->extent.height;
		drp = &dstRect;
	}
	if (rsrc)
	{
		srcRect.x = rsrc->corner.x;
		srcRect.y = rsrc->corner.y;
		srcRect.w = rsrc->extent.width;
		srcRect.h = rsrc->extent.height;
		srp = &srcRect;
	}
	else if (srcFrame->HotSpot.x || srcFrame->HotSpot.y)
	{
		if (rdst)
		{
			dstRect.x -= srcFrame->HotSpot.x;
			dstRect.y -= srcFrame->HotSpot.y;
		}
		else
		{
			dstRect.x = -srcFrame->HotSpot.x;
			dstRect.y = -srcFrame->HotSpot.y;
			dstRect.w = GetFrameWidth (srcFrame);
			dstRect.h = GetFrameHeight (srcFrame);
			drp = &dstRect;
		}

	}
	TFB_BlitSurface (src, srp, dst, drp, num, denom);
	UnlockMutex (srcImg->mutex);
	UnlockMutex (dstImg->mutex);
}
开发者ID:0xDEC0DE,项目名称:uqm-0.6.4-ee,代码行数:49,代码来源:3do_getbody.c


示例7: TFB_DrawImage_Intersect

BOOLEAN
TFB_DrawImage_Intersect (TFB_Image *img1, POINT img1org,
		TFB_Image *img2, POINT img2org, const RECT *interRect)
{
	BOOLEAN ret;

	LockMutex (img1->mutex);
	LockMutex (img2->mutex);
	ret = TFB_DrawCanvas_Intersect (img1->NormalImg, img1org,
			img2->NormalImg, img2org, interRect);
	UnlockMutex (img2->mutex);
	UnlockMutex (img1->mutex);

	return ret;
}
开发者ID:Serosis,项目名称:UQM-MegaMod,代码行数:15,代码来源:tfb_draw.c


示例8: FlushFadeXForms

static void
FlushFadeXForms (void)
{
	LockMutex (fadeLock);
	finishPendingFade ();
	UnlockMutex (fadeLock);
}
开发者ID:Serosis,项目名称:UQM-MegaMod,代码行数:7,代码来源:cmap.c


示例9: _ReleaseMusicData

BOOLEAN
_ReleaseMusicData (void *data)
{
	TFB_SoundSample **pmus = data;
	TFB_SoundSample *sample;

	if (pmus == NULL)
		return (FALSE);

	sample = *pmus;
	assert (sample != 0);
	if (sample->decoder)
	{
		TFB_SoundDecoder *decoder = sample->decoder;
		LockMutex (soundSource[MUSIC_SOURCE].stream_mutex);
		if (soundSource[MUSIC_SOURCE].sample == sample)
		{	// Currently playing this sample! Not good.
			StopStream (MUSIC_SOURCE);
		}
		UnlockMutex (soundSource[MUSIC_SOURCE].stream_mutex);

		sample->decoder = NULL;
		SoundDecoder_Free (decoder);
	}
	TFB_DestroySoundSample (sample);
	FreeMusicData (data);

	return (TRUE);
}
开发者ID:Serosis,项目名称:UQM-MegaMod,代码行数:29,代码来源:music.c


示例10: RosterCleanup

static void
RosterCleanup (MENU_STATE *pMS)
{
	if (pMS->flash_task)
	{
		UnlockMutex (GraphicsLock);
		ConcludeTask (pMS->flash_task);
		LockMutex (GraphicsLock);
		pMS->flash_task = 0;
	}

	if (pMS->CurFrame)
	{
		STAMP s;
		SHIP_FRAGMENT *StarShipPtr;

		SetContext (StatusContext);
		s.origin = pMS->first_item;
		StarShipPtr = LockShipFrag (&GLOBAL (built_ship_q),
				(HSHIPFRAG)pMS->CurFrame);
		s.frame = StarShipPtr->icons;
		UnlockShipFrag (&GLOBAL (built_ship_q), (HSHIPFRAG)pMS->CurFrame);
		if (!(pMS->CurState & SHIP_TOGGLE))
			DrawStamp (&s);
		else
		{
			SetContextForeGroundColor (WHITE_COLOR);
			DrawFilledStamp (&s);
		}
	}
}
开发者ID:0xDEC0DE,项目名称:uqm-0.6.4-ee,代码行数:31,代码来源:roster.c


示例11: AddCRL

/* Add Decoded CRL, 0 on success */
static int AddCRL(WOLFSSL_CRL* crl, DecodedCRL* dcrl)
{
    CRL_Entry* crle;

    WOLFSSL_ENTER("AddCRL");

    crle = (CRL_Entry*)XMALLOC(sizeof(CRL_Entry), crl->heap, DYNAMIC_TYPE_CRL_ENTRY);
    if (crle == NULL) {
        WOLFSSL_MSG("alloc CRL Entry failed");
        return -1;
    }

    if (InitCRL_Entry(crle, dcrl) < 0) {
        WOLFSSL_MSG("Init CRL Entry failed");
        XFREE(crle, crl->heap, DYNAMIC_TYPE_CRL_ENTRY);
        return -1;
    }

    if (LockMutex(&crl->crlLock) != 0) {
        WOLFSSL_MSG("LockMutex failed");
        FreeCRL_Entry(crle, crl->heap);
        XFREE(crle, crl->heap, DYNAMIC_TYPE_CRL_ENTRY);
        return BAD_MUTEX_E;
    }
    crle->next = crl->crlList;
    crl->crlList = crle;
    UnLockMutex(&crl->crlLock);

    return 0;
}
开发者ID:atigyi,项目名称:wolfssl,代码行数:31,代码来源:crl.c


示例12: Imo2sproxy_Exit

static void Imo2sproxy_Exit(IMO2SPROXY *hInst)
{
	IMO2SPROXY_INST *hProxy = (IMO2SPROXY_INST*)hInst;
	CONNINST *pInst;

	if (hProxy->pCfg->bVerbose && hProxy->pCfg->fpLog)
		fprintf (hProxy->pCfg->fpLog, "W32SkypeEmu:Exit()\n");

	if (hProxy->hWndDispatch) DestroyWindow (hProxy->hWndDispatch);
	if (hProxy->dwThreadID) PostThreadMessage (hProxy->dwThreadID, WM_QUIT, 0, 0);
	LockMutex(hProxy->loopmutex);

	// Kill 'em all!
	if (hProxy->hClients)
	{
		while (pInst=List_Pop(hProxy->hClients))
		{
			FreeConnection(pInst);
			free (pInst);
		}
		List_Exit (hProxy->hClients);
	}

	UnregisterClass ("Imo2SProxyDispatchWindow", GetModuleHandle(NULL));

	UnlockMutex(hProxy->loopmutex);
	ExitMutex(hProxy->loopmutex);

	free (hProxy);
}
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:30,代码来源:w32skypeemu.c


示例13: AlienTalkSegue

void
AlienTalkSegue (COUNT wait_track)
{
	// this skips any talk segues that follow an aborted one
	if ((GLOBAL (CurrentActivity) & CHECK_ABORT) || TalkingFinished)
		return;

	if (!pCurInputState->Initialized)
	{
		InitSpeechGraphics ();
		LockMutex (GraphicsLock);
		SetColorMap (GetColorMapAddress (CommData.AlienColorMap));
		SetContext (AnimContext);
		DrawAlienFrame (NULL, 0, TRUE);
		UpdateSpeechGraphics ();
		CommIntroTransition ();
		UnlockMutex (GraphicsLock);
		
		pCurInputState->Initialized = TRUE;

		PlayMusic (CommData.AlienSong, TRUE, 1);
		SetMusicVolume (BACKGROUND_VOL);

		InitCommAnimations ();

		LastActivity &= ~CHECK_LOAD;
	}
	
	TalkingFinished = TalkSegue (wait_track);
	if (TalkingFinished)
		FadeMusic (FOREGROUND_VOL, ONE_SECOND);
}
开发者ID:SirDifferential,项目名称:Shiver-Balance-Mod,代码行数:32,代码来源:comm.c


示例14: GetOcspEntry

static int GetOcspEntry(WOLFSSL_OCSP* ocsp, OcspRequest* request,
                                                              OcspEntry** entry)
{
    WOLFSSL_ENTER("GetOcspEntry");

    *entry = NULL;

    if (LockMutex(&ocsp->ocspLock) != 0) {
        WOLFSSL_LEAVE("CheckCertOCSP", BAD_MUTEX_E);
        return BAD_MUTEX_E;
    }

    for (*entry = ocsp->ocspList; *entry; *entry = (*entry)->next)
        if (XMEMCMP((*entry)->issuerHash,    request->issuerHash,
                                                         OCSP_DIGEST_SIZE) == 0
        &&  XMEMCMP((*entry)->issuerKeyHash, request->issuerKeyHash,
                                                         OCSP_DIGEST_SIZE) == 0)
            break;

    if (*entry == NULL) {
        *entry = (OcspEntry*)XMALLOC(sizeof(OcspEntry),
                                                 NULL, DYNAMIC_TYPE_OCSP_ENTRY);
        if (*entry) {
            InitOcspEntry(*entry, request);
            (*entry)->next = ocsp->ocspList;
            ocsp->ocspList = *entry;
        }
    }

    UnLockMutex(&ocsp->ocspLock);

    return *entry ? 0 : MEMORY_ERROR;
}
开发者ID:agnov8,项目名称:wolfssl,代码行数:33,代码来源:ocsp.c


示例15: DrawDevices

static void
DrawDevices (DEVICES_STATE *devState, COUNT OldDevice, COUNT NewDevice)
{
	LockMutex (GraphicsLock);
	BatchGraphics ();

	SetContext (StatusContext);

	if (OldDevice > NUM_DEVICES)
	{	// Asked for the initial display or refresh
		DrawDevicesDisplay (devState);

		// do not draw unselected again this time
		OldDevice = NewDevice;
	}

	if (OldDevice != NewDevice)
	{	// unselect the previous element
		DrawDevice (devState->list[OldDevice], OldDevice - devState->topIndex,
				false);
	}

	if (NewDevice < NUM_DEVICES)
	{	// select the new element
		DrawDevice (devState->list[NewDevice], NewDevice - devState->topIndex,
				true);
	}

	UnbatchGraphics ();
	UnlockMutex (GraphicsLock);
}
开发者ID:SirDifferential,项目名称:Shiver-Balance-Mod,代码行数:31,代码来源:devices.c


示例16: StopTrack

void
StopTrack (void)
{
    LockMutex (soundSource[SPEECH_SOURCE].stream_mutex);
    StopStream (SPEECH_SOURCE);
    track_count = 0;
    tracks_length = 0;
    cur_chunk = NULL;
    cur_sub_chunk = NULL;
    UnlockMutex (soundSource[SPEECH_SOURCE].stream_mutex);

    if (chunks_head)
    {
        chunks_tail = NULL;
        destroy_SoundChunk_list (chunks_head);
        chunks_head = NULL;
        last_sub = NULL;
    }
    if (sound_sample)
    {
        // We delete the decoders ourselves
        sound_sample->decoder = NULL;
        TFB_DestroySoundSample (sound_sample);
        sound_sample = NULL;
    }
}
开发者ID:ptaoussanis,项目名称:urquan-masters,代码行数:26,代码来源:trackplayer.c


示例17: TFB_ReturnColorMap

void
TFB_ReturnColorMap (TFB_ColorMap *map)
{
	LockMutex (maplock);
	release_colormap (map);
	UnlockMutex (maplock);
}
开发者ID:jurchik,项目名称:project6014,代码行数:7,代码来源:cmap.c


示例18: EventHandler

// -----------------------------------------------------------------------------
static void EventHandler(char *pszMsg, void *pUser)
{
	CONNINST *pInst = (CONNINST*)pUser;
	unsigned int uiLen = strlen (pszMsg);
	static BOOL bFirstLogin = TRUE;

	if (pInst->hProxy->pCfg->bVerbose && pInst->hProxy->pCfg->fpLog)
	{
		fprintf (pInst->hProxy->pCfg->fpLog, "%03d> %s\n", pInst->hSock, pszMsg);
		fflush (pInst->hProxy->pCfg->fpLog);
	}
	if (bFirstLogin && strncmp (pszMsg, "CONNSTATUS", 10) == 0 &&
		strcmp(pszMsg+11, "CONNECTING"))
	{
		pInst->iConnectionStat = (strcmp(pszMsg+11, "ONLINE")==0);
		UnlockMutex (pInst->connected);
		bFirstLogin = FALSE;
	}
	LockMutex(pInst->sendmutex);
	if (!(SendPacket (pInst, &uiLen, sizeof(uiLen)) && SendPacket (pInst, pszMsg, uiLen)))
	{
		//Dispatcher_Stop(pInst);
		//FreeConnection (pInst);
	}
	UnlockMutex(pInst->sendmutex);
}
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:27,代码来源:socksproxy.c


示例19: GetFadeAmount

int
GetFadeAmount (void)
{
	int newAmount;

	LockMutex (XFormControl.Lock);

	if (fadeInterval)
	{	// have a pending fade
		TimeCount Now = GetTimeCounter ();
		sint32 elapsed;
		
		elapsed = Now - fadeStartTime;
		if (elapsed > fadeInterval)
			elapsed = fadeInterval;

		newAmount = fadeAmount + (long)fadeDelta * elapsed / fadeInterval;

		if (elapsed >= fadeInterval)
		{	// fade is over
			fadeAmount = newAmount;
			fadeInterval = 0;
		}
	}
	else
	{	// no fade pending, return the current
		newAmount = fadeAmount;
	}

	UnlockMutex (XFormControl.Lock);

	return newAmount;
}
开发者ID:jurchik,项目名称:project6014,代码行数:33,代码来源:cmap.c


示例20: FlushFadeXForms

static void
FlushFadeXForms (void)
{
	LockMutex (XFormControl.Lock);
	finishPendingFade ();
	UnlockMutex (XFormControl.Lock);
}
开发者ID:jurchik,项目名称:project6014,代码行数:7,代码来源:cmap.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ LockRelease函数代码示例发布时间:2022-05-30
下一篇:
C++ LockMut函数代码示例发布时间: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