Mercurial > blahgd > experimental
changeset 955:3330b6790449
update to new libjeffpc lock API
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Sun, 06 May 2018 17:54:07 -0400 |
parents | 2ff3f1268927 |
children | eaa83315c5fe |
files | file_cache.c math.c post.c post_index.c |
diffstat | 4 files changed, 16 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/file_cache.c Thu Apr 12 11:42:01 2018 -0400 +++ b/file_cache.c Sun May 06 17:54:07 2018 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> + * Copyright (c) 2014-2018 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -43,6 +43,9 @@ #define FILE_EVENTS (FILE_MODIFIED | FILE_ATTRIB) +static LOCK_CLASS(file_lock_lc); +static LOCK_CLASS(file_node_lc); + static avl_tree_t file_cache; static struct lock file_lock; @@ -225,7 +228,7 @@ { int ret; - MXINIT(&file_lock); + MXINIT(&file_lock, &file_lock_lc); avl_create(&file_cache, filename_cmp, sizeof(struct file_node), offsetof(struct file_node, node)); @@ -262,7 +265,7 @@ node->contents = NULL; node->needs_reload = true; - MXINIT(&node->lock); + MXINIT(&node->lock, &file_node_lc); refcnt_init(&node->refcnt, 1); list_create(&node->callbacks, sizeof(struct file_callback), offsetof(struct file_callback, list));
--- a/math.c Thu Apr 12 11:42:01 2018 -0400 +++ b/math.c Sun May 06 17:54:07 2018 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> + * Copyright (c) 2014-2018 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -47,6 +47,7 @@ * process doing its job; it can chdir as needed */ +static LOCK_CLASS(math_lc); static struct lock lock; static int pipefd = -1; @@ -369,5 +370,5 @@ pipefd = fd; - MXINIT(&lock); + MXINIT(&lock, &math_lc); }
--- a/post.c Thu Apr 12 11:42:01 2018 -0400 +++ b/post.c Sun May 06 17:54:07 2018 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2017 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> + * Copyright (c) 2009-2018 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -50,6 +50,8 @@ static struct mem_cache *post_cache; static struct mem_cache *comment_cache; +static LOCK_CLASS(post_lc); + static void post_remove_all_tags(avl_tree_t *taglist); static void post_remove_all_comments(struct post *post); @@ -426,7 +428,7 @@ list_create(&post->comments, sizeof(struct comment), offsetof(struct comment, list)); refcnt_init(&post->refcnt, 1); - MXINIT(&post->lock); + MXINIT(&post->lock, &post_lc); if ((err = __refresh(post))) goto err_free;
--- a/post_index.c Thu Apr 12 11:42:01 2018 -0400 +++ b/post_index.c Sun May 06 17:54:07 2018 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> + * Copyright (c) 2015-2018 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -176,6 +176,7 @@ static avl_tree_t index_by_cat; static struct lock index_lock; +static LOCK_CLASS(index_lock_lc); static struct mem_cache *index_entry_cache; static struct mem_cache *global_index_entry_cache; @@ -255,7 +256,7 @@ avl_create(&index_by_cat, post_tag_cmp, sizeof(struct post_subindex), offsetof(struct post_subindex, index)); - MXINIT(&index_lock); + MXINIT(&index_lock, &index_lock_lc); index_entry_cache = mem_cache_create("index-entry-cache", sizeof(struct post_index_entry),