Typically in threads, you don't attempt to pass values back in the pthread_join commands, what you typically do is you have them write their results into a shared structure. Otherwise you are casting things to and from a void * very often.
Other than that, it appears that a majority of your casting is incorrect, and that is what is causing your crash, it is attempting to dereference a pointer of different size.
Sorry I can't be of more help, but I just like giving hints and not complete solutions to homework.
|