Пример #1
0
void memory_context_thread_deallocate( void )
{
	memory_context_t* context = get_thread_memory_context();
	if( context )
		memory_deallocate( context );
	set_thread_memory_context( 0 );
}
Пример #2
0
void memory_context_pop( void )
{
	memory_context_t* context = get_thread_memory_context();
	if( context )
	{
		FOUNDATION_ASSERT_MSG( context->depth, "Memory context stack underflow" );
		--context->depth;
	}
}
Пример #3
0
void memory_context_push( uint16_t context_id )
{
	memory_context_t* context = get_thread_memory_context();
	if( !context )
	{
		context = memory_allocate_zero( sizeof( memory_context_t ), 0, MEMORY_PERSISTENT );
		set_thread_memory_context( context );
	}
	FOUNDATION_ASSERT_MSG( context->depth < BUILD_SIZE_MEMORY_CONTEXT_DEPTH, "Memory context stack overflow" );
	context->context[ context->depth ] = context_id;
	if( context->depth < BUILD_SIZE_MEMORY_CONTEXT_DEPTH-1 )
		++context->depth;
}
Пример #4
0
void
memory_context_push(hash_t context_id) {
	memory_context_t* context = get_thread_memory_context();
	if (!context) {
		context = memory_allocate(0, sizeof(memory_context_t) +
		                             (sizeof(hash_t) * _foundation_config.memory_context_depth),
		                          0, MEMORY_PERSISTENT | MEMORY_ZERO_INITIALIZED);
		set_thread_memory_context(context);
	}
	context->context[ context->depth ] = context_id;
	if (context->depth < (_foundation_config.memory_context_depth - 1))
		++context->depth;
}
Пример #5
0
uint16_t memory_context( void )
{
	memory_context_t* context = get_thread_memory_context();
	return ( context && ( context->depth > 0 ) ) ? context->context[ context->depth - 1 ] : MEMORYCONTEXT_GLOBAL;
}
Пример #6
0
hash_t
memory_context(void) {
	memory_context_t* context = get_thread_memory_context();
	return (context && (context->depth > 0)) ? context->context[ context->depth - 1 ] : 0;
}
Пример #7
0
void
memory_context_pop(void) {
	memory_context_t* context = get_thread_memory_context();
	if (context && (context->depth > 0))
		--context->depth;
}