generated from AfonsoCMSousa/CPP-OpenGLTemplate
fix: massive memory leak (not all fixed) and added more test cases
This commit is contained in:
+3
-1
@@ -6,6 +6,7 @@
|
||||
#include <stdatomic.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define G_CONSTANT 1.98f
|
||||
|
||||
@@ -148,7 +149,7 @@ void collision_update(Particle *particles, unsigned long long count, float resti
|
||||
|
||||
void *t_update(void *args) {
|
||||
Physics_params *params = (Physics_params *)args;
|
||||
while (params->exit != 1) {
|
||||
while (!params->exit) {
|
||||
pthread_mutex_lock(params->mutex);
|
||||
while (params->run == 0) {
|
||||
pthread_cond_wait(params->cond, params->mutex); // sleeps here
|
||||
@@ -202,6 +203,7 @@ void *t_update(void *args) {
|
||||
pthread_barrier_wait(params->barrier);
|
||||
}
|
||||
|
||||
printf("INFO: Thread %llu exiting\n", params->thread_id);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user