I’m trying to make a list of pointers to a structure called “thread”. Here is my attempt:
//kmalloc is my malloc, don't worry
struct thread **process0 = kmalloc(sizeof(struct *thread));
//^ This line is giving me a parse error
And basically I want process0[0] to be a pointer to a thread,
process0[1] to be a pointer to another thread,
process0[2] to be a pointer to yet another thread,
etc.
Later I may want to access one of the thread’s “addrspace” member (a pointer to an addrspace structure) along the following:
struct addrspace *test = process0[i][j]->addrspace;
Where I’m thinking proccess0[i] is a particular list of thread pointers, and process0[i][j] is a particular thread pointer from the particular list of thread pointers… Then I’d want to access one of its members via the -> operator.
I’ve always sucked at pointer arithmetic stuff and would like to get things cleared up. Thank you very much.
The datatype that you want is “pointer to struct thread”, or: