Vnepomuceno Posted November 4, 2009 at 06:24 PM Report Share #294715 Posted November 4, 2009 at 06:24 PM Boa noite, estou a fazer um programa em C que mexe com filas e com threads (programação concorrente) mas está-me a dar o erro: "error: dereferencing pointer to incomplete type". O código é: /* queue_element_t */ typedef struct queue_element { struct _sthread *thread; struct queue_element *next; } queue_element_t; /* queue_t */ typedef struct _queue { queue_element_t *first; queue_element_t *last; } queue_t; void queue_print(queue_t *queue) { queue_element_t *el = queue->first; struct _sthread *thr; if(el == NULL) { return; } for(thr = el->thread; el != NULL; el = el->next, thr = el->thread) { printf(" %d,%d", thr->tid, thr->quantum); } printf("\n"); } struct _sthread* queue_find_tid(queue_t *queue, int tid) { queue_element_t *el; struct _sthread *thr; for(el = queue->first, thr = el->thread; el != NULL; el = el->next, thr = el->thread) { if(thr->tid == tid) return el->thread; } return NULL; } Esse erro é apontado duas vezes para a linha printf(" %d,%d", thr->tid, thr->quantum); e uma para a linha if(thr->tid == tid) Alguém me pode ajudar a detectar o que está mal nestas linhas e o que precisa de ser mudado? Obrigado Link to comment Share on other sites More sharing options...
Baderous Posted November 4, 2009 at 06:30 PM Report Share #294717 Posted November 4, 2009 at 06:30 PM Tens o código da struct _sthread? Link to comment Share on other sites More sharing options...
Vnepomuceno Posted November 4, 2009 at 06:58 PM Author Report Share #294728 Posted November 4, 2009 at 06:58 PM Sim, é este: struct _sthread { sthread_ctx_t *saved_ctx; sthread_start_func_t start_routine_ptr; long wake_time; int join_tid; void* join_ret; void* args; int tid; int nice; int priority; int quantum; int rem_quantum; }; Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now