I need to write a program that creates 2 threads and writes their PIDs into a file each other time. as in pid a, pid b, pid a, pid b etc. into the file.
got this so far, that writes out my 2 PIDs. but I also want to loop it, tho looping a fork isn't really good. I've been adviced to use pthreads, but I've got no idea how that works, and I've been having a hard time googling pthreads to find any decent explanation of how it works. either way, I'd want to run thru this session atleast 5 times so I can get some data into a file.