Posted on 2001-08-05
I am working on a program, and I need to implement some threads. It needs to compile under both windows and linux. Right now I have the windows threads working using CreateThread. What I'm looking for is a good way to do it under linux, that is compatible with the way it is done in windows. (Basically all globals are shared and stacks are seperate.) I looked at fork, and that looked wrong, because there is seperate global areas. I then looked at __create(), and that looked like it would work, except that I couldn't figure out how/where to allocate and deallocate memory for the stack. I've heard there is a pthread_create that might work also. I'll give full points to whoever can post some small sample code that I can get to compile, that creates a few threads, accesses some global and local varibles, then quits correctly.