Category : pthreads

I have some problem following this installation guide https://github.com/laxnpander/OpenREALM_ROS1_Bridge Before quick start section, the command catkin_make -DCMAKE_BUILD_TYPE=Release does not work. It is the last step before to use the whole library. Someone can help me? Examples of the file CMakeError.log are: Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output: Change Dir: /home/mc/catkin_ws/build/CMakeFiles/CMakeTmp ..

Read more

The mutex object referenced by mutex shall be locked by calling pthread_mutex_lock(). If the mutex is already locked, the calling thread shall block until the mutex becomes available. This operation shall return with the mutex object referenced by mutex in the locked state with the calling thread as its owner. My question is if the ..

Read more

I have a program which uses MPI + Pthread. I’m stuck on implementing pthreads to share an array for read/writes. I made mock code here, which mimics the issue. #include <iostream> #include <unistd.h> #include <pthread.h> struct args { double* array; int start; int stop; double myVal; double* row; pthread_barrier_t* barrier; }; void* mythread(void* arguments){ struct ..

Read more

I’m having an attempt at the famous producer-consumer problem in c++ and I have came up with an implementation like this… #include <iostream> #include <pthread.h> #include <unistd.h> #include <ctime> void *consumeThread(void *i); void *produceThread(void *i); using std::cout; using std::endl; //Bucket size #define Bucket_size 10 int buckets[Bucket_size]; pthread_mutex_t lock; pthread_cond_t consume_now, produce_now; time_t timer; int o ..

Read more