Skip to content

Commit

Permalink
vlib: use sync.new_mutex() consistently for initialising all vlib str…
Browse files Browse the repository at this point in the history
…uctures containing mutex fields
  • Loading branch information
spytheman committed Aug 15, 2023
1 parent 2643970 commit 717076b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion vlib/clipboard/x11/clipboard.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ mut:
selection Atom // the selection atom
window Window
atoms []Atom
mutex &sync.Mutex = unsafe { nil }
mutex &sync.Mutex = sync.new_mutex()
text string // text data sent or received
got_text bool // used to confirm that we have got the text
is_owner bool // to save selection owner state
Expand Down
4 changes: 2 additions & 2 deletions vlib/context/cancel.v
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ pub struct CancelContext {
id string
mut:
context Context
mutex &sync.Mutex
mutex &sync.Mutex = sync.new_mutex()
done chan int
children map[string]Canceler
err IError
err IError = none
}

// with_cancel returns a copy of parent with a new done channel. The returned
Expand Down
4 changes: 2 additions & 2 deletions vlib/v/parser/parser.v
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,8 @@ pub fn (mut p Parser) parse() &ast.File {
struct Queue {
mut:
idx int
mu &sync.Mutex
mu2 &sync.Mutex
mu &sync.Mutex = sync.new_mutex()
mu2 &sync.Mutex = sync.new_mutex()
paths []string
table &ast.Table = unsafe { nil }
parsed_ast_files []&ast.File
Expand Down
2 changes: 1 addition & 1 deletion vlib/v/tests/str_gen_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ fn test_fixed_array_of_function() {
}

struct CTypeDefStruct {
mutex &sync.Mutex
mutex &sync.Mutex = sync.new_mutex()
}

fn test_c_struct_typedef() {
Expand Down

0 comments on commit 717076b

Please sign in to comment.