Hello, All.
unsigned long real_handle = _beginthreadex(NULL, 0, THREAD_ENTRYPOINT, THREAD_ARG, CREATE_SUSPENDED, &thread_id);
On Windows 64 bits this code can lose top 32 bits of returned handle causing all following code to fail completely.
IMHO, whole real_handle usage must be cleaned out. -- WBR, SD. Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel