Re: mt questions
"Pascal J. Bourguignon" <[email protected]>
| Newsgroups | gmane.lisp.clisp.devel |
|---|---|
| Organization | Informatimago |
| Message-ID | <[email protected]> |
shashank <[email protected]> writes: >>> 5. In [xthread.d, line 99,152] what does #define > THREADPROC_SIGNATURE do? >> This is just a syntax sugar to hide win32/posix thread function > return type. > Can you elaborate more? Use: M-x grep RET C-a C-k grep -nH THREADPROC_SIGNATURE *.d RET It is defined in two #ifdef: #if defined(POSIX_THREADS) // ... #define THREADPROC_SIGNATURE void * // ... #endif /* POSIX*_THREADS */ #if defined(WIN32_THREADS) // ... #define THREADPROC_SIGNATURE unsigned WINAPI // ... #endif /* WIN32_THREADS */ It is used in two functions: local THREADPROC_SIGNATURE thread_stub(void *arg) local THREADPROC_SIGNATURE mt_main_actions (void *param) So when we use POSIX_THREADS, those two functions will have the signature: local void * thread_stub(void *arg) local void * mt_main_actions (void *param) returning a pointer, but when we use WIN32_THREADS, they will have the signature: local unsigned WINAPI thread_stub(void *arg) local unsigned WINAPI mt_main_actions (void *param) returning a unsigned. This is the basic substitution mechanism of C pre-processor macros. What we've done here, is to conditionnalize the return type depending on the kind of threads we use. Similarly, the other xthread_* macros are defined differently depending on the kind of thread we use, so that we can write a single source text, that will be processed and produce a different source program depending on the kind of thread we use. -- __Pascal Bourguignon__ http://www.informatimago.com/ "Le mercure monte ? C'est le moment d'acheter !" ------------------------------------------------------------------------------ "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE Instantly run your Selenium tests across 300+ browser/OS combos. Get unparalleled scalability from the best Selenium testing platform available. Simple to use. Nothing to install. Get started now for free." http://p.sf.net/sfu/SauceLabs _______________________________________________ clisp-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/clisp-devel