⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tskalloc.cpp

📁 这是一个关于C++编程开发的算法!
💻 CPP
字号:
/*
   CPPTask - A Multitasking Kernel For C++

   Version 1.0 08-12-91

   Ported by Rich Smith from:

   Public Domain Software written by
      Thomas Wagner
      Patschkauer Weg 31
      D-1000 Berlin 33
      West Germany

   This module contains the memory allocation functions that are needed.

   TSKALLOC.CPP - Dynamic memory allocation interface

   Subroutines
        tsk_alloc
        tsk_free
        operator new
        operator delete

*/

#include "task.hpp"

#include <stdlib.h>

farptr tsk_alloc (word size)
{
   farptr ptr;

   alloc_resource.request_resource (0L);
   ptr = malloc (size);
   alloc_resource.release_resource ();

   return ptr;
}


void tsk_free (farptr item)
{
   alloc_resource.request_resource (0L);
   free (item);
   alloc_resource.release_resource ();
}

void* operator new(size_t size)
{
   return tsk_alloc(size);
}


void operator delete(void* item)
{
   tsk_free(item);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -