Functions | |
void * | rxv_spin_conn_get (rxv_spin_ctx_t *ctx, const char *conninfo) |
void * | rxv_spin_conn_set (rxv_spin_ctx_t *ctx, const char *conninfo, void *conn, apr_status_t(*cleanup)(void *data)) |
void* rxv_spin_conn_get | ( | rxv_spin_ctx_t * | ctx, | |
const char * | conninfo | |||
) |
Get a registered connection from the connection pool.
ctx | Context | |
conninfo | Connection string for this connection |
rxv_spin_conn_get(ctx,"openldap:ldap://ldap.example.com/dc=example,dc=com");
void* rxv_spin_conn_set | ( | rxv_spin_ctx_t * | ctx, | |
const char * | conninfo, | |||
void * | conn, | |||
apr_status_t(*)(void *data) | cleanup | |||
) |
Register a connection with the connection pool.
ctx | Context | |
conninfo | Connection string for this connection | |
conn | Connection pointer | |
cleanup | Cleanup function to call on pool destruction |
rxv_spin_conn_set(ctx,"openldap:ldap://host.domain/dc=example,dc=com", ldapconn,ldap_cleanup);
The lifetime of the connection and all other variables passed into this function has to be at least the lifetime of the connection pool you are registering the connection with. Normally, connection pools have thread lifetime, so if you have shorter lifetime for your connection (e.g. request, connection) or the connect string, you are setting yourself up for segfaults. Also, if the lifetime of the connection is longer than the one of the connection pool, for instance, if it has the lifetime of the process and you are registering it with the regular thread based connection pool, you may experience segfaults if you rely on that connection once the thread exited.