[haiku-development] Re: Lock/Thread private includes problem
- From: Julian Harnath <julian.harnath@xxxxxxxxxxxxxx>
- To: haiku-development@xxxxxxxxxxxxx
- Date: Mon, 07 May 2012 20:23:26 +0200
Ingo Weinhold <ingo_weinhold@xxxxxx> schrieb:
> <thread.h> includes <thread_types.h> which in turn includes <lock.h>
> (since locking primitives are used in the thread related structures).
So by including <thread.h> (or just <thread_types.h>) you get an include
cycle.
I noticed the cycle but hoped there would be some way out... and there
is still one thing that confuses me. It is of no pratical use, more a
technical detail: if I add #include <thread.h> at the *end* of lock.h,
it still produces lots of errors. Why does that happen? Including it at
the end is of course not useful, but when doing that, a later-included
thread_types.h should be able to see everything from lock.h, right?
Anyone have an idea?
The function I need in lock.h is thread_get_current_thread() which is a
macro that points to various arch-dependent inline functions, so pretty
much the worst-case here ;-) ... forward-declarations don't help and
pulling the inline functions into separate header-files for every arch
is a little more change than I want to do. So either I revert some of
my changes and go without using that function, or I add another new
function somewhere (maybe in a new file) that simply wraps around
thread_get_current_thread(). Brrr, C preprocessor and its consequences :
\
Greetings,
Julian
Other related posts: