cel_pgsql: deadlock on unload and core_event_dispatcher
[asterisk/asterisk.git] / cel / cel_pgsql.c
index 5ba5b99..8db85d7 100644 (file)
@@ -346,8 +346,9 @@ ast_log_cleanup:
 static int my_unload_module(void)
 {
        struct columns *current;
-       AST_RWLIST_WRLOCK(&psql_columns);
+
        ast_cel_backend_unregister(PGSQL_BACKEND_NAME);
+       AST_RWLIST_WRLOCK(&psql_columns);
        if (conn) {
                PQfinish(conn);
                conn = NULL;