Skip to content

Instantly share code, notes, and snippets.

@beetleskin
beetleskin / LoadBalancer.hpp
Last active August 29, 2015 14:05
a thread pool manager for cpp
/**
* TODO: * Threads could block each other: When a job thread starts another job-thread,
* the child one wont be executed, if the max number of threads is already reached.
* The child will wait for ever in the queue, the parent will wait for the child.
* Right now the constructor parameter <inception> needs to be set to true, if
* the LoadBalancer is created within an already running job. If so, the maximum
* number of threads is altered by one (since the parent one should just be waiting
* for the jobs). There sure are better ways to solve this ...
* * double list of running jobs, one static to check if this_thread is in there?
* * doing everythin global (static or singleton) and remove the parent one from
#include "LoadBalancer.hpp"
int LoadBalancer::running_thread_count = 0;
int LoadBalancer::max_threads = 5;
mutex LoadBalancer::global_mutex;
LoadBalancer::LoadBalancer(bool inception):
inception(inception),
@beetleskin
beetleskin / gtsam_point_covariance_test.py
Created March 22, 2022 12:08
Covariances for GTSAM point-features
import gtsam
import gtsam_unstable
def point_covaraince_test():
# graph with point-features
# ---------------------------
p_obs = gtsam.Point2(1, 2)
cov = np.array(((2., -1.), (-1., 3.)))