Skip to content

Tag: pthreads

PHP pthreads failing when run from cron

Ok, so lets start slow… I have a pthreads script running and working for me, tested and working 100% of the time when I run it manually from the command line via ssh. The script is as follows with the main thread process code adjusted to simulate random process’ run time. So while the above script…

pthread not waiting for mutex lock threadFinished

Hi below is my coding snippet When statement1 & statement2 are commented I am expecting child thread to change my testrunning variable first before main thread but it is working properly only when statement1 and statement2 are uncommented. My question is why in child thread mutex lock is not locking my te…

fwrite fopen blocking threads

I have a multithreaded linux app written in c running on a i.mx6 arm. I have a 25lc256 spi eeprom mapped to the file system. Writes are relatively slow at the driver level, not much can be done there. The problem is that file functions are blocking other threads for too long. usleep additions don’t seem…

Linux scheduling. (pthreads)

I’m trying to play around with threads and so far, with the code below, I’m doing fine. I want also want to print the current index of the executing thread but I’ve encountered some problems. I’m trying to print the current executing thread along with “Hello world!”. But, t…

Get/Set the pthread scheduling policy in Linux

The code below is a sample provided by the book in my Operating Systems course. When compiling it I get the error shown below it. I compiled it using this command… However, I get this error. I tried adding -pthread: but the error remains. Thanks for your help! Answer You have the correct compiling comma…