deadlock on console mutex in gdb

David McFarland corngood@gmail.com
Wed Dec 22 22:17:20 GMT 2021


Takashi Yano <takashi.yano@nifty.ne.jp> writes:

> Thanks for the report.
> Could you provide simple test case in C?

Sure, this seems to do it:

===== test.c
#include <pthread.h>
#include <stdio.h>

void *thread(void* p) {
        printf("thread %p\n", p);
        return 0;
}

int main() {
        pthread_t ids[100];
        for (int i = 0; i < 100; ++i) {
                pthread_create(&ids[i], 0, &thread, &ids[i]);
        }
        for (int i = 0; i < 100; ++i) {
                pthread_join(ids[i], 0);
        }
        return 0;
}
=====

If I compile that with gcc and run it under gdb, it hangs almost
immediately. 5/5 attempts using a fresh cygwin with latest packages.


More information about the Cygwin-developers mailing list