mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-23 20:35:42 +02:00
module/i3: use lock provided by generic module
This commit is contained in:
parent
2c7362fefa
commit
661cabfb69
1 changed files with 4 additions and 7 deletions
|
@ -40,7 +40,6 @@ struct private {
|
||||||
int left_spacing;
|
int left_spacing;
|
||||||
int right_spacing;
|
int right_spacing;
|
||||||
|
|
||||||
mtx_t lock;
|
|
||||||
struct {
|
struct {
|
||||||
struct ws_content *v;
|
struct ws_content *v;
|
||||||
size_t count;
|
size_t count;
|
||||||
|
@ -331,7 +330,7 @@ run(struct module_run_context *ctx)
|
||||||
struct json_object *json = json_tokener_parse(json_str);
|
struct json_object *json = json_tokener_parse(json_str);
|
||||||
assert(json != NULL);
|
assert(json != NULL);
|
||||||
|
|
||||||
mtx_lock(&m->lock);
|
mtx_lock(&ctx->module->lock);
|
||||||
|
|
||||||
switch (hdr->type) {
|
switch (hdr->type) {
|
||||||
case I3_IPC_REPLY_TYPE_VERSION:
|
case I3_IPC_REPLY_TYPE_VERSION:
|
||||||
|
@ -363,7 +362,7 @@ run(struct module_run_context *ctx)
|
||||||
default: assert(false);
|
default: assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
mtx_unlock(&m->lock);
|
mtx_unlock(&ctx->module->lock);
|
||||||
|
|
||||||
json_object_put(json);
|
json_object_put(json);
|
||||||
json_tokener_free(tokener);
|
json_tokener_free(tokener);
|
||||||
|
@ -392,7 +391,6 @@ destroy(struct module *mod)
|
||||||
free(m->ws_content.v);
|
free(m->ws_content.v);
|
||||||
workspaces_free(m);
|
workspaces_free(m);
|
||||||
|
|
||||||
mtx_destroy(&m->lock);
|
|
||||||
free(m);
|
free(m);
|
||||||
module_default_destroy(mod);
|
module_default_destroy(mod);
|
||||||
}
|
}
|
||||||
|
@ -402,7 +400,7 @@ content(struct module *mod)
|
||||||
{
|
{
|
||||||
struct private *m = mod->private;
|
struct private *m = mod->private;
|
||||||
|
|
||||||
mtx_lock(&m->lock);
|
mtx_lock(&mod->lock);
|
||||||
|
|
||||||
struct exposable *particles[m->workspaces.count];
|
struct exposable *particles[m->workspaces.count];
|
||||||
|
|
||||||
|
@ -447,7 +445,7 @@ content(struct module *mod)
|
||||||
tag_set_destroy(&tags);
|
tag_set_destroy(&tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
mtx_unlock(&m->lock);
|
mtx_unlock(&mod->lock);
|
||||||
return dynlist_exposable_new(
|
return dynlist_exposable_new(
|
||||||
particles, particle_count, m->left_spacing, m->right_spacing);
|
particles, particle_count, m->left_spacing, m->right_spacing);
|
||||||
}
|
}
|
||||||
|
@ -461,7 +459,6 @@ module_i3(struct i3_workspaces workspaces[], size_t workspace_count,
|
||||||
m->left_spacing = left_spacing;
|
m->left_spacing = left_spacing;
|
||||||
m->right_spacing = right_spacing;
|
m->right_spacing = right_spacing;
|
||||||
|
|
||||||
mtx_init(&m->lock, mtx_plain);
|
|
||||||
m->ws_content.count = workspace_count;
|
m->ws_content.count = workspace_count;
|
||||||
m->ws_content.v = malloc(workspace_count * sizeof(m->ws_content.v[0]));
|
m->ws_content.v = malloc(workspace_count * sizeof(m->ws_content.v[0]));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue