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

C++ os_error函数代码示例

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

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



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

示例1: vmem_unmapfile

void vmem_unmapfile()
{
    dbg_printf("vmem_unmapfile()\n");

    vmem_decommit(preserve,preserve_size);
    vmem_release(preserve,preserve_size);
    preserve = NULL;
    preserve_size = 0;

#if 0
    if (pview)
    {   int i;

        i = UnmapViewOfFile(pview);
        dbg_printf("i = x%x\n",i);
        if (i == FALSE)
            os_error();
    }
#else
    // Note that under Windows 95, UnmapViewOfFile() seems to return random
    // values, not TRUE or FALSE.
    if (pview && UnmapViewOfFile(pview) == FALSE)
        os_error();
#endif
    pview = NULL;

    if (hFileMap != NULL && CloseHandle(hFileMap) != TRUE)
        os_error();
    hFileMap = NULL;

    if (hFile != INVALID_HANDLE_VALUE && CloseHandle(hFile) != TRUE)
        os_error();
    hFile = INVALID_HANDLE_VALUE;
}
开发者ID:DinrusGroup,项目名称:DRC,代码行数:34,代码来源:os.c


示例2: vmem_setfilesize

void vmem_setfilesize(unsigned long size)
{
    if (hFile != INVALID_HANDLE_VALUE)
    {   if (SetFilePointer(hFile,size,NULL,FILE_BEGIN) == 0xFFFFFFFF)
            os_error();
        if (SetEndOfFile(hFile) == FALSE)
            os_error();
    }
}
开发者ID:DinrusGroup,项目名称:DRC,代码行数:9,代码来源:os.c


示例3: rt_stk_check

__weak void rt_stk_check (void) {
  /* Check for stack overflow. */
  if ((os_tsk.run->tsk_stack < (U32)os_tsk.run->stack) || 
      (os_tsk.run->stack[0] != MAGIC_WORD)) {
    os_error (OS_ERR_STK_OVF);
  }
}
开发者ID:GuentherMartin,项目名称:CMSIS_5,代码行数:7,代码来源:rt_System.c


示例4: os_heapterm

void os_heapterm()
{
    if (hHeap)
    {   if (HeapDestroy(hHeap) == FALSE)
            os_error();
    }
}
开发者ID:DinrusGroup,项目名称:DRC,代码行数:7,代码来源:os.c


示例5: os_mbx_psh

void os_mbx_psh (P_MCB p_CB, void *p_msg) {
  /* Store the message to the mailbox queue or pass it to task directly. */
  P_TCB p_TCB;

  /* Check if this was an 'isr_mbx_receive ()' post service request.   */
  if (p_CB->p_lnk != NULL && p_CB->isr_st == 2) {
    /* A task is waiting to send message, remove it from the waiting list. */
    p_CB->isr_st = 0;
    p_TCB = os_get_first ((P_XCB)p_CB);
    p_TCB->ret_val = OS_R_OK;
    goto rdy;
  }
  /* A task is waiting for message, pass the message to task directly. */
  if (p_CB->p_lnk != NULL && p_CB->count == 0) {
    p_TCB = os_get_first ((P_XCB)p_CB);
    p_TCB->p_msg = p_msg;
    p_TCB->ret_val = OS_R_MBX;
rdy:p_TCB->state = READY;
    os_rmv_dly (p_TCB);
    os_put_prio (&os_rdy, p_TCB);
  }
  else {
    /* No task is waiting for message, store it to the mailbox queue. */
    if (p_CB->count < p_CB->size) {
      p_CB->msg[p_CB->first] = p_msg;
      _incw (&p_CB->count);
      if (++p_CB->first == p_CB->size) {
        p_CB->first = 0;
      }
    }
    else {
      os_error (OS_ERR_MBX_OVF);
    }
  }
}
开发者ID:ChrisXin,项目名称:ECE254-1,代码行数:35,代码来源:rt_Mailbox.c


示例6: vmem_decommit

void vmem_decommit(void *ptr,unsigned long size)
{
    dbg_printf("vmem_decommit(ptr = %p, size = x%lx)\n",ptr,size);
    if (ptr)
    {   if (!VirtualFree(ptr, size, MEM_DECOMMIT))
            os_error();
    }
}
开发者ID:DinrusGroup,项目名称:DRC,代码行数:8,代码来源:os.c


示例7: tell_position

long tell_position (FILE *file) 
{
  long size;
  if ((size = ftell (file)) < 0) {
    os_error();
  }
  return size;
}
开发者ID:simoncozens,项目名称:dvipdfm-x,代码行数:8,代码来源:mfileio.c


示例8: fc_strdup_notrim

char *
fc_strdup_notrim (const char *src, gfc_charlen_type src_len)
{
  char *p = strndup (src, src_len);
  if (!p)
    os_error ("Memory allocation failed in fc_strdup");
  return p;
}
开发者ID:gmarkall,项目名称:gcc,代码行数:8,代码来源:string.c


示例9: auto_codec_open_decoder

void auto_codec_open_decoder(const auto_codec & context, AVCodecID codec_id)
{
    boost::mutex::scoped_lock lock(avcodec_mutex);
    AVCodec * codec = avcodec_find_decoder(codec_id);
    if (!codec)
	throw os_error("avcodec_find_decoder", ENOENT);
    os_check_error("avcodec_open", -avcodec_open2(context.get(), codec, NULL));
}
开发者ID:jdsn,项目名称:dvswitch,代码行数:8,代码来源:auto_codec.cpp


示例10: make_os_error

    static os_error make_os_error(int err, const std::string& text = "")
    {
        std::stringstream msg;
        msg << "errno: " << err;
        if (!text.empty())
            msg << " - " << text;

        return os_error(err, msg.str());
    }
开发者ID:BrendanLeber,项目名称:mdups,代码行数:9,代码来源:mdups.cpp


示例11: os_freelibrary

void os_freelibrary()
{
    if (hdll)
    {
        if (FreeLibrary(hdll) != TRUE)
            os_error();
        hdll = NULL;
    }
}
开发者ID:DinrusGroup,项目名称:DRC,代码行数:9,代码来源:os.c


示例12: vmem_release

void vmem_release(void *ptr,unsigned long size)
{
    dbg_printf("vmem_release(ptr = %p, size = x%lx)\n",ptr,size);
    if (ptr)
    {
        if (!VirtualFree(ptr, 0, MEM_RELEASE))
            os_error();
    }
}
开发者ID:DinrusGroup,项目名称:DRC,代码行数:9,代码来源:os.c


示例13: assert

void *os_getprocaddress(const char *funcname)
{   void *fp;

    //printf("getprocaddress('%s')\n",funcname);
    assert(hdll);
    fp = (void *)GetProcAddress(hdll,(LPCSTR)funcname);
    if (!fp)
        os_error();
    return fp;
}
开发者ID:DinrusGroup,项目名称:DRC,代码行数:10,代码来源:os.c


示例14: os_term

void os_term()
{
    if (hHeap)
    {   if (HeapDestroy(hHeap) == FALSE)
        {   hHeap = NULL;
            os_error();
        }
        hHeap = NULL;
    }
    os_freelibrary();
}
开发者ID:DinrusGroup,项目名称:DRC,代码行数:11,代码来源:os.c


示例15: rt_stk_check

/*--------------------------- rt_stk_check ----------------------------------*/
__weak void rt_stk_check (void) {
    /* Check for stack overflow. */
    if (os_tsk.run->task_id == 0x01) {
        // TODO: For the main thread the check should be done against the main heap pointer
    } else {
        if ((os_tsk.run->tsk_stack < (U32)os_tsk.run->stack) ||
            (os_tsk.run->stack[0] != MAGIC_WORD)) {
            os_error (OS_ERR_STK_OVF);
        }
    }
}
开发者ID:Babody,项目名称:mbed,代码行数:12,代码来源:rt_System.c


示例16: xcalloc

void *
xcalloc (size_t nmemb, size_t size)
{
  if (nmemb * size == 0)
    nmemb = size = 1;

  void *p = calloc (nmemb, size);
  if (!p)
    os_error ("Allocating cleared memory failed");

  return p;
}
开发者ID:ChaosJohn,项目名称:gcc,代码行数:12,代码来源:memory.c


示例17: rt_psq_enq

void rt_psq_enq (OS_ID entry, U32 arg) {
  /* Insert post service request "entry" into ps-queue. */
  U32 idx;

  idx = rt_inc_qi (os_psq->size, &os_psq->count, &os_psq->first);
  if (idx < os_psq->size) {
    os_psq->q[idx].id  = entry;
    os_psq->q[idx].arg = arg;
  }
  else {
    os_error (OS_ERR_FIFO_OVF);
  }
}
开发者ID:lyncxy119,项目名称:Sentry,代码行数:13,代码来源:rt_List.c


示例18: VirtualAlloc

void *vmem_reserve(void *ptr,unsigned long size)
{   void *p;

#if 1
    p = VirtualAlloc(ptr,size,MEM_RESERVE,PAGE_READWRITE);
    dbg_printf("vmem_reserve(ptr = %p, size = x%lx) = %p\n",ptr,size,p);
#else
    dbg_printf("vmem_reserve(ptr = %p, size = x%lx) = %p\n",ptr,size,p);
    p = VirtualAlloc(ptr,size,MEM_RESERVE,PAGE_READWRITE);
    if (!p)
        os_error();
#endif
    return p;
}
开发者ID:DinrusGroup,项目名称:DRC,代码行数:14,代码来源:os.c


示例19: xmalloc

void *
xmalloc (size_t n)
{
  void *p;

  if (n == 0)
    n = 1;

  p = malloc (n);

  if (p == NULL)
    os_error ("Memory allocation failed");

  return p;
}
开发者ID:ChaosJohn,项目名称:gcc,代码行数:15,代码来源:memory.c


示例20: get_mem

void *
get_mem (size_t n)
{
  void *p;

#ifdef GFC_CLEAR_MEMORY
  p = (void *) calloc (1, n);
#else
  p = (void *) malloc (n);
#endif
  if (p == NULL)
    os_error ("Memory allocation failed");

  return p;
}
开发者ID:mbref,项目名称:gcc-412-microblaze,代码行数:15,代码来源:memory.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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