#ifndef _aplmt_memory_mallocapi_h_
#define _aplmt_memory_mallocapi_h_
/*----------------------------------------------------------------------------
** SUMMARY: Memory Allocation (MEMMT)
**
** DESCRIPTION:
**  This file provides thread-safe extensions to the basic APL MEM
**  interface.  The application must 'build' the basic MEM interface and follow
**  all of the setup/configuration specified for that interface. This MT
**  interface can be used in 'parallel' (i.e. co-exist) with other Memory 
**  interfaces (threaded or non-threaded).  In fact, it is technically OK
**  to mix the calls to the the basic MEM interfaces with calls to this
**  interface (MEMMT), JUST BE SURE YOU KNOW WHAT YOU ARE DOING.
**
**  HEAP-SIZE
**  ---------
**      See apl/memory/mallocapi.h
** 
**  OUT-OF-MEMORY
**  -------------
**      See apl/memory/mallocapi.h
**
**  MINIMUM ALLOCATION SIZE
**  -----------------------
**      See apl/memory/mallocapi.h
** 
**  STANDARD C LIBRARY
**  ------------------
**      See apl/memory/mallocapi.h
**
**  MEMORY ALIGNMENT
**  ----------------
**      See apl/memory/mallocapi.h
**
**
** CONFIGURATION 
** -------------
**  COMPILE:     See apl/memory/mallocapi.h
**
**  APPLICATION: See apl/memory/mallocapi.h
**
**  PLATFORM:    none.
**
**
**  NOTES:
**  1. Unless explicitly stated otherwise, NONE of the following methods may be 
**     called from interrupt service routines.
**  2. Unless explicitly stated otherwise, NONE of the following methods may be 
**     called before the platform's kernel is running.
**  3. Unless explicitly stated otherwise, all of the following methods ARE 
**     thread-safe.
**  4. For efficency/optimization some methods are 'inlined'.  The inlining
**     is done by using the preprocessor/macros.  The application should
**     treat all methods as function calls and not rely on the fact they may
**     be currently defined as macros.
----------------------------------------------------------------------------*/

#include "apl/memory/mallocapi.h"      /* For: parent/base interface */


#ifdef __cplusplus
extern "C" {
#endif


/*-------------- INLINE IMPLEMENTATION -------------------------------------*/
#include "aplmt/memory/malloc.h"            /* For: inline MT implementation */


/*-------------- INHERITED PARENT API --------------------------------------*/
/** The parent/base API methods are enumerated below.  The inherited methods
    are NOT thread-safe. For a up-to-date list reference the parent class 
    directly.

    Prototypes:
        void  Apl_initMalloc(void);
        void* Apl_malloc( AplSize_t numBytes );
        void  Apl_free( void* memoryToFree );
*/


/*-------------- PUBLIC/PUBLISHED API --------------------------------------*/
/** This method is a thread-safe version of Apl_malloc().
    NOTES:
        o This method can ONLY be called once the kernel is running.
        o This method is thread-safe, and as such may: block on a mutex,
          disable scheduling, or disable interrupts for the duration of the 
          call (it is platform dependent).
        o As a general rule, do NOT mix calls to the non-thread
          safe and thread safe version of malloc.  The ONLY exception
          to this rule is during start-up.  It is OK, to call the non-thread
          safe version of malloc before the kernel is started, and then
          the thread-safe version once the kernel is running.

    Prototype:
        void* Aplmt_malloc( AplSize_t numBytes );
 */
#define Aplmt_malloc                    _Aplmt_malloc

/** This method is a a thread-safe version of Apl_free().
    NOTES:
        o This method can ONLY be called once the kernel is running.
        o This method is thread-safe, and as such may: block on a mutex,
          disable scheduling, or disable interrupts for the duration of the 
          call (it is platform dependent).
        o It is OK to free memory allocated by Apl_malloc() with
          this method.
              
    Prototype:
        void Aplmt_free( void* memoryToFree );
 */
#define Aplmt_free                      _Aplmt_free


#ifdef __cplusplus
}
#endif
/*--------------------------------------------------------------------------*/
#endif  /* end _aplmt_memory_mallocapi_h_ */

