Skip to content

Commit

Permalink
Add a new freeFunctionsSync
Browse files Browse the repository at this point in the history
Signed-off-by: Binbin <[email protected]>
  • Loading branch information
enjoy-binbin committed Nov 21, 2024
1 parent 0d43d18 commit 2796c56
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
15 changes: 10 additions & 5 deletions src/functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,21 @@ void functionsLibCtxClearCurrent(int async) {
}
}

/* Free the given functions ctx */
void freeFunctionsSync(functionsLibCtx *functions_lib_ctx) {
functionsLibCtxClear(functions_lib_ctx);
dictRelease(functions_lib_ctx->functions);
dictRelease(functions_lib_ctx->libraries);
dictRelease(functions_lib_ctx->engines_stats);
zfree(functions_lib_ctx);
}

/* Free the given functions ctx */
void functionsLibCtxFree(functionsLibCtx *functions_lib_ctx, int async) {
if (async) {
freeFunctionsAsync(functions_lib_ctx);
} else {
functionsLibCtxClear(functions_lib_ctx);
dictRelease(functions_lib_ctx->functions);
dictRelease(functions_lib_ctx->libraries);
dictRelease(functions_lib_ctx->engines_stats);
zfree(functions_lib_ctx);
freeFunctionsSync(functions_lib_ctx);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ size_t functionsLibCtxFunctionsLen(functionsLibCtx *functions_ctx);
functionsLibCtx *functionsLibCtxGetCurrent(void);
functionsLibCtx *functionsLibCtxCreate(void);
void functionsLibCtxClearCurrent(int async);
void freeFunctionsSync(functionsLibCtx *functions_lib_ctx);
void functionsLibCtxFree(functionsLibCtx *functions_lib_ctx, int async);
void functionsLibCtxClear(functionsLibCtx *lib_ctx);
void functionsLibCtxSwapWithCurrent(functionsLibCtx *new_lib_ctx, int async);
Expand Down
2 changes: 1 addition & 1 deletion src/lazyfree.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ void freeFunctionsAsync(functionsLibCtx *functions_lib_ctx) {
memory_order_relaxed);
bioCreateLazyFreeJob(lazyFreeFunctionsCtx, 1, functions_lib_ctx);
} else {
functionsLibCtxFree(functions_lib_ctx, 0);
freeFunctionsSync(functions_lib_ctx);
}
}

Expand Down

0 comments on commit 2796c56

Please sign in to comment.