qf_gc.c File Reference

QF_gc() implementation. More...

#include "qf_pkg.h"
#include "qassert.h"

Go to the source code of this file.

Functions

void QF_gc (QEvent const *e)
 Recycle a dynamic event.

Detailed Description

QF_gc() implementation.

Definition in file qf_gc.c.


Function Documentation

void QF_gc ( QEvent const *  e  ) 

Recycle a dynamic event.

This function implements a simple garbage collector for the dynamic events. Only dynamic events are candidates for recycling. (A dynamic event is one that is allocated from an event pool, which is determined as non-zero e->attrQF__ attribute.) Next, the function decrements the reference counter of the event, and recycles the event only if the counter drops to zero (meaning that no more references are outstanding for this event). The dynamic event is recycled by returning it to the pool from which it was originally allocated. The pool-of-origin information is stored in the upper 2-MSBs of the e->attrQF__ attribute.)

Note:
QF invokes the garbage collector at all appropriate contexts, when an event can become garbage (automatic garbage collection), so the application code should have no need to call QF_gc() directly. The QF_gc() function is exposed only for special cases when your application sends dynamic events to the "raw" thread-safe queues (see QEQueue). Such queues are processed outside of QF and the automatic garbage collection is CANNOT be performed for these events. In this case you need to call QF_gc() explicitly.

Definition at line 40 of file qf_gc.c.

References Q_ASSERT, QF_EPOOL_PUT_, QF_maxPool_, QF_pool_, QS_BEGIN_NOLOCK_, QS_END_NOLOCK_, QS_QF_GC, QS_QF_GC_ATTEMPT, QS_SIG_, and QS_U8_.

Referenced by QF_publish(), and QF_run().

Generated on Tue Mar 16 19:38:10 2010 for QP/C by  doxygen 1.6.3