yeah...sorry about the vagueness of "this". I was referring to just having the signal handler make the child call _exit when it recieves the signal and then resetting the shared counter back to 0.
...
Type: Posts; User: Abs
yeah...sorry about the vagueness of "this". I was referring to just having the signal handler make the child call _exit when it recieves the signal and then resetting the shared counter back to 0.
...
Interesting, I didn't know you could set a mutex to span multiple processes... I always thought the pthread library was more specific to the threads located in a single process. But I guess now that...
Nevermind, I just realized I don't need to share that between processes as the signal handler only cares about the current running process. Maybe I'll forget the whole decrement forced exit...so...
Is there an easy way to share a volatile sig_atomic_t between processes? If I have to add it to my shared memory segment then I would need to still attach to the shared memory and update the value. ...
Well, it's interesting... I'm now using semaphores to protect the shared memory and I'm still getting the same behavior as before where for somereason one of the child processes goes to sleep......
Thank you so much for those links, I'm still going through them. And am going to take a stab at implementing it with a semaphore. I'll post back with my results. Another question though... With...
brewbuck, thank you for your comments... Since I'm doing everything with fork, I would need to do a considerable rewrite to get this working using threads instead, so I'd like to avoid pthreads. ...
right, from what I've read since getting in and only incrementing/decrementing a counter is such a small and fast operation a spinlock is ideal as it doesn't require any context switches etc... and...
Sure thing.
Here is my code snippet that does the checking and and forking etc... My scontext is a struct with two integers.. children and updating.
if...
Hey all, I'm not the most seasoned person writing in C however I'd like to think I'm coming along :-) I'm just about finished with a program I've been writing for a little while now that is a basic...