osip-dev
[Top][All Lists]
Advanced

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

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


From: Aymeric Moizard
Subject: Re: [osip-dev] transaction is not NULL, but transactionff is
Date: Mon, 6 Nov 2017 21:59:15 -0700

Hi!

I don't think the fifo could be NULL.

I advise you to display the pointer of transaction when you:
1/ allocate them
2/ execute them
3/ free them

Then, you will know more about the pointer which is failing?

Maybe checking with a memory checker tool such as valgrind will tell you more?

Keep me posted!
Aymeric


Le 6 nov. 2017 05:27, "Máté Eckl" <address@hidden> a écrit :
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;
}

_______________________________________________
osip-dev mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/osip-dev


reply via email to

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