found and fixed thread bugs

master
Allen Webster 2016-07-20 15:19:10 -04:00
parent b49df12f6f
commit 468fe81f61
3 changed files with 8 additions and 7 deletions

View File

@ -202,9 +202,9 @@ static void*
general_memory_allocate(General_Memory *general, int32_t size){ general_memory_allocate(General_Memory *general, int32_t size){
void *result = 0; void *result = 0;
if (size < BUBBLE_MIN_SIZE) size = BUBBLE_MIN_SIZE; if (size < BUBBLE_MIN_SIZE) size = BUBBLE_MIN_SIZE;
for (Bubble *bubble = general->free_sentinel.next2; for (Bubble *bubble = general->sentinel.next;
bubble != &general->free_sentinel; bubble != &general->sentinel;
bubble = bubble->next2){ bubble = bubble->next){
if (!(bubble->flags & MEM_BUBBLE_USED)){ if (!(bubble->flags & MEM_BUBBLE_USED)){
if (bubble->size >= size){ if (bubble->size >= size){
result = bubble + 1; result = bubble + 1;

View File

@ -1227,7 +1227,7 @@ Job_Callback_Sig(job_full_lex){
system->grow_thread_memory(memory); system->grow_thread_memory(memory);
lex.tb = (char*)memory->data; lex.tb = (char*)memory->data;
tokens.tokens = (Cpp_Token*)((char*)memory->data + buffer_size); tokens.tokens = (Cpp_Token*)((char*)memory->data + buffer_size);
tokens.max_count = memory->size / sizeof(Cpp_Token); tokens.max_count = (memory->size - buffer_size) / sizeof(Cpp_Token);
break; break;
case LexHitTokenLimit: case LexHitTokenLimit:
@ -6119,7 +6119,7 @@ live_set_alloc_view(Live_Views *live_set, Panel *panel, Models *models){
init_query_set(&result.view->query_set); init_query_set(&result.view->query_set);
{ {
i32 gui_mem_size = Kbytes(32); i32 gui_mem_size = Kbytes(512);
void *gui_mem = general_memory_allocate(&models->mem.general, gui_mem_size + 8); void *gui_mem = general_memory_allocate(&models->mem.general, gui_mem_size + 8);
result.view->gui_mem = gui_mem; result.view->gui_mem = gui_mem;
gui_mem = advance_to_alignment(gui_mem); gui_mem = advance_to_alignment(gui_mem);

View File

@ -597,7 +597,7 @@ JobThreadProc(LPVOID lpParameter){
full_job->job.callback(&win32vars.system, full_job->job.callback(&win32vars.system,
thread, thread_memory, full_job->job.data); thread, thread_memory, full_job->job.data);
PostMessage(win32vars.window_handle, WM_4coder_ANIMATE, 0, 0); PostMessage(win32vars.window_handle, WM_4coder_ANIMATE, 0, 0);
full_job->running_thread = 0; //full_job->running_thread = 0;
thread->running = 0; thread->running = 0;
system_acquire_lock(cancel_lock); system_acquire_lock(cancel_lock);
@ -688,7 +688,8 @@ flush_to_direct_queue(Unbounded_Work_Queue *source_queue, Work_Queue *queue, i32
} }
else if (source_queue->skip > UNBOUNDED_SKIP_MAX){ else if (source_queue->skip > UNBOUNDED_SKIP_MAX){
u32 left_over = source_queue->count - source_queue->skip; u32 left_over = source_queue->count - source_queue->skip;
memmove(queue->jobs, queue->jobs + source_queue->skip, left_over); memmove(source_queue->jobs, source_queue->jobs + source_queue->skip,
sizeof(Full_Job_Data)*left_over);
source_queue->count = left_over; source_queue->count = left_over;
source_queue->skip = 0; source_queue->skip = 0;
} }