コード例 #1
0
/**
 *  name::  StreamCtrlInit
 *          初始化StreamCtrl控制结构体(for PlayUtilityHandler.c)
 **/
static int StreamCtrlInit(void)
{
    StreamCtrl_Type *streamCtrl;

    playerLogDebug("StreamCtrlInit.\n");

    //TODO:: init message queue
    gMsgQueue = MessageQueueCreate(sizeof(PlayerCommand_Type));

    //TODO:: init gStreamCtrl && gPlayerCtrl
    streamCtrl = (StreamCtrl_Type *)malloc(sizeof(StreamCtrl_Type));
    if (streamCtrl == NULL)
        playerLogError("streamCtrl malloc error.\n");
    memset(streamCtrl, 0, sizeof(StreamCtrl_Type));
    streamCtrl->msgQueue = gMsgQueue;

    if (ThreadMutexLock(gStreamCtrlMutex))
        playerLogWarning("thread mutex locking error.\n");
    gStreamCtrl = streamCtrl;
    playerLogInfo("gStreamCtrl[%p],streamCtrl->msgQueue[%p]\n", gStreamCtrl, streamCtrl->msgQueue);
    if (ThreadMutexUnLock(gStreamCtrlMutex))
        playerLogWarning("thread mutex locking error.\n");

    return 0;
}
コード例 #2
0
ファイル: LinuxTWI.c プロジェクト: coherentsolutions/libtsctl
int LinuxTWILock(LinuxTWI *twi,unsigned num,int flags) {
  int ret,mode;

  if (flags & SHARED) return -11;
  mode = (flags & NONBLOCKING) ? 
    LOCK_TRY :
    (flags & NOUNLOCK) ? LOCK_FOD : LOCK_SOD;
  if ((ret=ThreadMutexLock(twi->LockNum,mode)) < 0) return ret;

  if (!twi->f) {
    twi->f = open(twi->devfile,O_RDWR);
  }
  return 1;
}
コード例 #3
0
/**
 *  name::  PlayCtrlInit
 *          初始化PlayCtrl控制结构体(for PlayUtility4UpperInterfaces.cpp)
 **/
static int PlayCtrlInit(void)
{
    PlayCtrl_type *playCtrl;

    playerLogDebug("PlayCtrlInit.\n");


    //TODO:: init play structure gPlayerCtrl
    playCtrl = (PlayCtrl_type *)malloc(sizeof(PlayCtrl_type));
    if (playCtrl == NULL)
        playerLogError("playCtrl malloc error.\n");
    memset(playCtrl, 0, sizeof(PlayCtrl_type));

    if (ThreadMutexLock(gPlayCtrlMutex))
        playerLogWarning("thread mutex locking error.\n");
    gPlayerCtrl = playCtrl;
    playerLogVerbose("gPlayerCtrl address[%p]\n", gPlayerCtrl);
    if (ThreadMutexUnLock(gPlayCtrlMutex))
        playerLogWarning("thread mutex locking error.\n");

    playerLogDebug("PlayCtrlInit END.\n");
    return 0;
}