lhmouse / mcfgthread

Cornerstone of the MOST efficient std::thread on Windows for mingw-w64
https://gcc-mcf.lhmouse.com/
Other
277 stars 28 forks source link

Function declaration incorrect for c11 #79

Closed trcrsired closed 1 year ago

trcrsired commented 1 year ago
#include <threads.h>
#include <stdio.h>

int run(void *arg)
{
    printf("Hello world of C11 threads.");

    return 0;
}

int main(int argc, const char *argv[])
{
    thrd_t thread;
    int result;

    thrd_create(&thread, run, NULL);

    thrd_join(&thread, &result);

    printf("Thread return %d at the end\n", result);
}
threadtest.c: In function 'main': threadtest.c:18:15: warning: passing argument 1 of 'thrd_join' from incompatible pointer type [-Wincompatible-pointer-types] 18 thrd_join(&thread, &result); ^~~
_MCF_thread **

In file included from d:\x86_64-windows-gnu\x86_64-w64-mingw32-mcf\x86_64-w64-mingw32\include\threads.h:3, from threadtest.c:1: d:\x86_64-windows-gnu\x86_64-w64-mingw32-mcf\x86_64-w64-mingw32\include\mcfgthread\c11.h:304:42: note: expected 'thrd_t' {aka '_MCF_thread *'} but argument is of type '_MCF_thread *' 304 | MCF_ALWAYS_INLINE int thrd_join(thrd_t thrd, int resp_opt) __MCF_NOEXCEPT { return MCF_c11_thrd_join(thrd, resp_opt); }