![]() |
pl-nk v0.4.5
Plonk|Plink|Plank are a set of cross-platform C/C++ frameworks for audio software development
|
00001 /* 00002 ------------------------------------------------------------------------------- 00003 This file is part of the Plink, Plonk, Plank libraries 00004 by Martin Robinson 00005 00006 http://code.google.com/p/pl-nk/ 00007 00008 Copyright University of the West of England, Bristol 2011-14 00009 All rights reserved. 00010 00011 Redistribution and use in source and binary forms, with or without 00012 modification, are permitted provided that the following conditions are met: 00013 00014 * Redistributions of source code must retain the above copyright 00015 notice, this list of conditions and the following disclaimer. 00016 * Redistributions in binary form must reproduce the above copyright 00017 notice, this list of conditions and the following disclaimer in the 00018 documentation and/or other materials provided with the distribution. 00019 * Neither the name of University of the West of England, Bristol nor 00020 the names of its contributors may be used to endorse or promote products 00021 derived from this software without specific prior written permission. 00022 00023 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00024 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00025 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00026 DISCLAIMED. IN NO EVENT SHALL UNIVERSITY OF THE WEST OF ENGLAND, BRISTOL BE 00027 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00028 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 00029 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00030 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00031 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00032 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00033 00034 This software makes use of third party libraries. For more information see: 00035 doc/license.txt included in the distribution. 00036 ------------------------------------------------------------------------------- 00037 */ 00038 00039 // unlikely to implement now... other more straightforward solutions used... 00040 00041 //#ifndef PLANK_LOCKFREEMEMORY_H 00042 //#define PLANK_LOCKFREEMEMORY_H 00043 // 00044 //#include "../containers/plank_LockFreeStack.h" 00045 // 00046 //PLANK_BEGIN_C_LINKAGE 00047 // 00048 //typedef struct PlankLockFreeMemory* PlankLockFreeMemoryRef; 00049 // 00050 //PlankLockFreeMemoryRef pl_LockFreeMemory_CreateAndInit(); 00051 //PlankLockFreeMemoryRef pl_LockFreeMemory_Create(); 00052 //PlankResult pl_LockFreeMemory_Init (PlankLockFreeMemoryRef p); 00053 //PlankResult pl_LockFreeMemory_DeInit (PlankLockFreeMemoryRef p); 00054 //PlankResult pl_LockFreeMemory_Destroy (PlankLockFreeMemoryRef p); 00055 //void* pl_LockFreeMemory_AllocateBytes (PlankLockFreeMemoryRef p, PlankUL numBytes); 00056 //PlankResult pl_LockFreeMemory_Free (PlankLockFreeMemoryRef p, void* ptr); 00057 // 00058 //PLANK_END_C_LINKAGE 00059 // 00061 // 00062 //struct PlankLockFreeMemoryDescriptorQueue; 00063 //struct PlankLockFreeMemoryAnchor; 00064 //struct PlankLockFreeMemoryDescriptor; 00065 //struct PlankLockFreeMemorySizeClass; 00066 //struct PlankLockFreeMemoryActive; 00067 //struct PlankLockFreeMemoryProcessHeap; 00068 // 00069 //typedef struct PlankLockFreeMemoryDescriptorQueue* PlankLockFreeMemoryDescriptorQueueRef; 00070 //typedef struct PlankLockFreeMemoryAnchor* PlankLockFreeMemoryAnchorRef; 00071 //typedef struct PlankLockFreeMemoryDescriptor* PlankLockFreeMemoryDescriptorRef; 00072 //typedef struct PlankLockFreeMemorySizeClass* PlankLockFreeMemorySizeClassRef; 00073 //typedef struct PlankLockFreeMemoryActive* PlankLockFreeMemoryActiveRef; 00074 //typedef struct PlankLockFreeMemoryProcessHeap* PlankLockFreeMemoryProcessHeapRef; 00075 // 00076 //#if !DOXYGEN 00077 // 00079 // 00080 //#define PLANKLOCKFREEMEMORY_TYPE_SIZE (4) 00081 //#define PLANKLOCKFREEMEMORY_PTR_SIZE (sizeof(void*)) 00082 //#define PLANKLOCKFREEMEMORY_HEADER_SIZE (PLANKLOCKFREEMEMORY_TYPE_SIZE + PLANKLOCKFREEMEMORY_PTR_SIZE) 00083 // 00084 //#define PLANKLOCKFREEMEMORY_LARGE (0) 00085 //#define PLANKLOCKFREEMEMORY_SMALL (1) 00086 // 00087 //#define PLANKLOCKFREEMEMORY_PAGESIZE (4096) 00088 //#define PLANKLOCKFREEMEMORY_SUPERBLOCKSIZE (16 * PLANKLOCKFREEMEMORY_PAGESIZE) 00089 //#define PLANKLOCKFREEMEMORY_DESCSUPERBLOCKBSIZE (1024 * sizeof (descriptor)) 00090 // 00091 //#define PLANKLOCKFREEMEMORY_ACTIVE (0) 00092 //#define PLANKLOCKFREEMEMORY_FULL (1) 00093 //#define PLANKLOCKFREEMEMORY_PARTIAL (2) 00094 //#define PLANKLOCKFREEMEMORY_EMPTY (3) 00095 // 00096 //#define PLANKLOCKFREEMEMORY_ACTIVEPTRBITS (58) 00097 //#define PLANKLOCKFREEMEMORY_ACTIVECREDITBITS (6) 00098 // 00099 //#define PLANKLOCKFREEMEMORY_MAXCREDITS (1L << PLANKLOCKFREEMEMORY_ACTIVECREDITBITS) 00100 //#define PLANKLOCKFREEMEMORY_GRANULARITY (8) 00101 // 00102 //#define PLANKLOCKFREEMEMORY_NUMSIZECLASSES (2048 / PLANKLOCKFREEMEMORY_GRANULARITY) 00103 // 00105 // 00106 //typedef struct PlankLockFreeMemoryDescriptorQueue 00107 //{ 00108 // PlankBits descriptoAvailable:46; 00109 // PlankBits tag:18; 00110 //} PlankLockFreeMemoryDescriptorQueue; 00111 // 00113 // * to 24 bits to support larger superblock sizes. */ 00114 //typedef struct PlankLockFreeMemoryAnchor 00115 //{ 00116 // PlankBits avail:24; 00117 // PlankBits count:24; 00118 // PlankBits state:2; 00119 // PlankBits tag:14; 00120 //} PlankLockFreeMemoryAnchor; 00121 // 00122 //typedef struct PlankLockFreeMemoryDescriptor 00123 //{ 00124 // PlankLockFreeStackElement padding; 00125 // volatile PlankLockFreeMemoryAnchor anchor; 00126 // PlankLockFreeMemoryDescriptorRef next; 00127 // PlankP superBlock; // pointer to superblock 00128 // PlankLockFreeMemoryProcessHeapRef heap; // pointer to owner procheap 00129 // PlankUI size; // block size 00130 // PlankUI maxCount; // superblock size / sz 00131 //} PlankLockFreeMemoryDescriptor; 00132 // 00133 //typedef struct PlankLockFreeMemorySizeClass 00134 //{ 00135 // PlankLockFreeStack partial; // initially empty 00136 // PlankUI size; // block size 00137 // PlankUI superBlockSize; // superblock size 00138 //} PlankLockFreeMemorySizeClass; 00139 // 00140 //typedef struct PlankLockFreeMemoryActive 00141 //{ 00142 // PlankBits ptr:58; 00143 // PlankBits credits:6; 00144 //} PlankLockFreeMemoryActive; 00145 // 00146 //typedef struct PlankLockFreeMemoryProcessHeap 00147 //{ 00148 // volatile PlankLockFreeMemoryActive active; // initially NULL 00149 // volatile PlankLockFreeMemoryDescriptorRef partial; // initially NULL 00150 // PlankLockFreeMemorySizeClassRef sizeclass; // pointer to parent sizeclass 00151 //} PlankLockFreeMemoryProcessHeap; 00152 // 00154 // 00155 //typedef struct PlankLockFreeMemory 00156 //{ 00157 // PlankLockFreeMemorySizeClass sizeClasses[PLANKLOCKFREEMEMORY_NUMSIZECLASSES]; 00158 // PlankLockFreeMemoryProcessHeapRef heaps[PLANKLOCKFREEMEMORY_NUMSIZECLASSES]; 00159 //} PlankLockFreeMemory; 00160 //#endif 00161 // 00163 // 00164 // 00165 //#endif // PLANK_LOCKFREEMEMORY_H