本文整理汇总了C++中UnlockMutex函数的典型用法代码示例。如果您正苦于以下问题:C++ UnlockMutex函数的具体用法?C++ UnlockMutex怎么用?C++ UnlockMutex使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UnlockMutex函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例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);
}
示例3: 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);
}
示例4: 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);
}
示例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);
}
示例6: 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;
}
示例7: _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);
}
示例8: FlushFadeXForms
static void
FlushFadeXForms (void)
{
LockMutex (XFormControl.Lock);
finishPendingFade ();
UnlockMutex (XFormControl.Lock);
}
示例9: 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;
}
示例10: TFB_ReturnColorMap
void
TFB_ReturnColorMap (TFB_ColorMap *map)
{
LockMutex (maplock);
release_colormap (map);
UnlockMutex (maplock);
}
示例11: 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);
}
示例12: TFB_DrawImage_Delete
void
TFB_DrawImage_Delete (TFB_Image *image)
{
if (image == 0)
{
log_add (log_Warning, "INTERNAL ERROR: Tried to delete a null image!");
/* Should we die here? */
return;
}
LockMutex (image->mutex);
TFB_DrawCanvas_Delete (image->NormalImg);
if (image->ScaledImg)
{
TFB_DrawCanvas_Delete (image->ScaledImg);
image->ScaledImg = 0;
}
if (image->FilledImg)
{
TFB_DrawCanvas_Delete (image->FilledImg);
image->FilledImg = 0;
}
UnlockMutex (image->mutex);
DestroyMutex (image->mutex);
HFree (image);
}
示例13: 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);
}
示例14: GiveRadios
static void
GiveRadios (RESPONSE_REF R)
{
if (PLAYER_SAID (R, we_will_transfer_now))
{
SET_GAME_STATE (RADIOACTIVES_PROVIDED, 1);
NPCPhrase (FUEL_UP0);
NPCPhrase (FUEL_UP1);
AlienTalkSegue (1);
LockMutex (GraphicsLock);
//CommData.AlienAmbientArray[2].AnimFlags |= ANIM_DISABLED; // JMS
UnlockMutex (GraphicsLock);
XFormColorMap (GetColorMapAddress (
SetAbsColorMapIndex (CommData.AlienColorMap, 0)
), ONE_SECOND / 2);
AlienTalkSegue ((COUNT)~0);
RevealSelf (0);
}
else
{
if (PLAYER_SAID (R, what_will_you_give_us))
NPCPhrase (MESSAGE_GARBLED_1);
else if (PLAYER_SAID (R, before_radios_we_need_info))
NPCPhrase (MESSAGE_GARBLED_2);
Response (we_will_transfer_now, GiveRadios);
Response (what_will_you_give_us, GiveRadios);
Response (before_radios_we_need_info, GiveRadios);
}
}
示例15: FlushFadeXForms
static void
FlushFadeXForms (void)
{
LockMutex (fadeLock);
finishPendingFade ();
UnlockMutex (fadeLock);
}