I think that the question is pretty self-explanatory, however here is an example of what I am referring to. say we have
static void *foo(void * bar) {
//some random function/method/calculation/data manipulation.
}
is it safe/possible to create multiple threads and use that same function? I have a very lengthy file (approaching 1000 lines) Its starting to get lengthy to scroll up and down. long story short I can't afford errors or unintended functioning. Or would my better bet be to simply create another C file? my mutexing and everything is solid. so I'm not too worried.
int main() {
Is something like this feasable?:
pthread_t A1, A2;
pthread_creat(&A1, NULL, foo, &foobar);
pthread_create(&A2, NULL, foo, &foobar);
pthread_join(A1, NULL);
pthread_join(A2, NULL);
}
if i choose to head into this route any advice/precautions?