2013-06-12 2 views
0

내 응용 프로그램에서 스레드 풀링 시스템을 구현하려고합니다. 나는 각 쓰레드가 내가 사용하고있는 쓰레드 풀링 구조에 대한 포인터를 가지고 있다고 생각한다. 따라서 기본적으로 다음과 같은 두 가지 구조가 있습니다.두 구조체가 서로 포함될 때 경고 메시지가 나타나지 않도록하십시오.

typedef struct thread_pool { 
    /* some fields here */ 
    single_thread **tds; 
} thread_pool_t; 

typedef struct single_thread { 
    /* some fields here */ 
    thread_pool_t *tp; 
} single_thread_t; 

선언 순서와 별도로 컴파일러에서 오류가 발생합니다. 나는 첫 번째 구조 앞에 두 번째 구조를 선언하는 것을 해결했지만 비어 있다고 선언했다. 이제는 오류가 발생하지 않지만 항상 다음과 같은 경고가 표시됩니다.

serv_inc/thrhandler.h:23:16: warning: useless storage class specifier in empty declaration [enabled by default] 

이 경고를 피하고 같은 결과를 얻을 수있는 방법이 있습니까? 내가 잘못하고 있으며이 문제에 대한보다 효율적인 해결책이 있습니까?

+1

. 'struct' 키워드가없고 forward 선언이 있어야합니다. [SSCCE] (http://sscce.org/)를 게시하십시오. –

답변

6

이 나를 위해 작동합니다 :이 작동하지 않을 수 있습니다

typedef struct thread_pool thread_pool_t; 
typedef struct single_thread single_thread_t; 

struct thread_pool 
{ 
    single_thread_t **tds; 
}; 

struct single_thread 
{ 
    thread_pool_t *tp; 
}; 
관련 문제