Работа над документацией

This commit is contained in:
2026-04-25 22:00:40 +05:00
parent 8ebacd77eb
commit 7d00738b55
25 changed files with 980 additions and 185 deletions
+36
View File
@@ -0,0 +1,36 @@
#include "FXAlloc.h"
#include <threads.h>
// В этой переменной настраиваем градации и предположительное количесвто блоков
static const FXGrade grades[] = {
{ 32, 200 }, { 64, 200 }, { 128, 8000 },
{ 256, 4000 }, { 512, 2000 }, { 1024, 1200 },
{ 4096, 200 }, { 0x10000, 4 },
{ 0 } // Ноль-терминант
};
#ifdef _WIN32
// Windows-версия
__declspec(thread) extern void* (*fxalloc)(size_t _NBytes);
__declspec(thread) extern void (*fxfree)(void* _Ptr);
#else
// POSIX-версия
extern static pthread_key_t thread_key;
extern void* (*fxalloc)(size_t _NBytes);
extern void (*fxfree)(void* _Ptr);
#endif
extern static pthread_key_t thread_key;
void* fastalloc();
void init_tls() {
pthread_setspecific(thread_key, (void*)fxalloc);
fxalloc = fastalloc;
// или более сложный вариант с хранением структуры
}