osip-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[osip-dev] transaction is not NULL, but transactionff is


From: Máté Eckl
Subject: [osip-dev] transaction is not NULL, but transactionff is
Date: Mon, 6 Nov 2017 13:26:43 +0100

Hi,

I am trying to handle timers inside transactions, and I just met a strange thing. In my code I process every event in all of the transactions in the ICT transaction list, and at some point I get a pointer where the transaction is not NULL, but the transaction fifo is. I suppose that might happen, when I try to handle a transaction that has just been terminated, but this way I do not understand how can it be in the list.

So lets assume that I have a transaction that has just been terminated, then the next element of the transaction list should not be an invalid transaction, should it? It is in my case. If I do not use an if to examine if the fifo is not NULL, it causes segfault when trying to get the semaphore.
This only happens when I execute ICT timers. Before that call there had been no problem with this.

Could somebody explain this situation to me?

My code can be seen at the bottom. In spite of the function name, it is single-threaded right now.

Regards,
Máté

---

int _execute_all_transactions(osip_list_t transactions) {
osip_event_t *se = NULL;
osip_transaction_t *transaction = NULL;
osip_list_iterator_t i;
int err = 1;

for(osip_list_get_first(&(transactions), &i); osip_list_iterator_has_elem(i); osip_list_get_next(&i)) {
transaction = (osip_transaction_t *)i.actual->element;
if(NULL == transaction->transactionff) // supposingly when a transaction has just been terminated
continue;
while (NULL != (se = (osip_event_t *)osip_fifo_tryget(transaction->transactionff))) {
err = osip_transaction_execute (transaction, se);
if(err != 1)
return err;
}
}
return 1;
}

void *othread_func(void *arg) {
osip_t *context = (osip_t *)arg;

osip_timers_ict_execute(context);
_execute_all_transactions(context->osip_ict_transactions);

return NULL;
}

reply via email to

[Prev in Thread] Current Thread [Next in Thread]