0

My issue concerns this line:

    int f = makecontext( &threadList[ numThreads ].context

My program compiles without error without the assignment operation, but does not work at all. The line appears to do nothing. When I add "int f =" the compiler gives me the error:

my_pthread.c:41:10: error: void value not ignored as it ought to be

I don't understand how this is happening, since ucontext should always return 0 or -1.

Any help is appreciated.

Aperson123
  • 129
  • 6

1 Answers1

2

The makecontext function is declared as:

void makecontext(ucontext_t *ucp, void (*func)(), int argc, ...);

It returns no value, so you can't assign the result of the function to anything.

dbush
  • 205,898
  • 23
  • 218
  • 273