sustrik / libdill

Structured concurrency in C
MIT License
1.68k stars 156 forks source link

choose() returns 0 on invalid handle #223

Open wusspuss opened 1 year ago

wusspuss commented 1 year ago
#include <stdio.h>
int main() {    
    int val1 = 0;
    int val2;
    struct chclause clauses[] = {
        {CHSEND, 100, &val1, sizeof(val1)},
        {CHRECV, 200, &val2, sizeof(val2)}
    };
    int rc = choose(clauses, 2, now() + 1000);
    printf("rc=%i, errno=%i\n",rc,errno);
    return 0;
}

prints rc=0, errno=9 When as per documentation rc should be -1.