Erick .. or anyone else .. I wrote some code that did: fprintf(stderr, "Thread=%ld\n", pthread_self());
Erick changed the call to use get_native_thread() so it works on Windows. However the above use still doesn't work, because no one says a thread id has to be a long integer required by the printf format. In fact on Windows I think it is a void* (which is a long long equivalent on XP64). The thread id is only printed for diagnostic purposes here. Using C++ may solve this: cerr << get_name_thread() should print all system types .. but it leaves me feeling very uneasy in respect of buffering and intermixing with more widely used fprintf(stderr,...) (including in other libraries). What's more cerr is a non-copyable lvalue, so in any use where the debug output was parametric we'd have to universally code *(cerr_ptr) << ... One solution would be a function long thread_id_as_long (flx_native_thread_t x) but that wouldn't work on Windows, and long long thread_id_as_long_long (..) isn't ISO C++ compliant because long long need not exist. Alternate forms of printf() format supporting this would be the right solution, but aren't standard for thread ids (although I think ?? the are for size_t, ptrdiff_t) etc. Any advice on the best solution here? -- John Skaller <skaller at users dot sf dot net> Felix, successor to C++: http://felix.sf.net ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language