parser: use parallel only on macos for now

pull/4987/head
Alexander Medvednikov 2020-05-22 02:45:11 +02:00
parent 1e853072dc
commit edabd57e8a
2 changed files with 20 additions and 18 deletions

View File

@ -171,24 +171,26 @@ fn (mut q Queue) run() {
pub fn parse_files(paths []string, table &table.Table, pref &pref.Preferences, global_scope &ast.Scope) []ast.File { pub fn parse_files(paths []string, table &table.Table, pref &pref.Preferences, global_scope &ast.Scope) []ast.File {
// println('nr_cpus= $nr_cpus') // println('nr_cpus= $nr_cpus')
if pref.is_parallel && paths[0].contains('/array.v') { $if macos {
println('\n\n\nparse_files() nr_files=$paths.len') if pref.is_parallel && paths[0].contains('/array.v') {
println(paths) println('\n\n\nparse_files() nr_files=$paths.len')
nr_cpus := runtime.nr_cpus() println(paths)
mut q := &Queue{ nr_cpus := runtime.nr_cpus()
paths: paths mut q := &Queue{
table: table paths: paths
pref: pref table: table
global_scope: global_scope pref: pref
mu: sync.new_mutex() global_scope: global_scope
mu2: sync.new_mutex() mu: sync.new_mutex()
mu2: sync.new_mutex()
}
for _ in 0 .. nr_cpus - 1 {
go q.run()
}
time.sleep_ms(1000)
println('all done')
return q.parsed_ast_files
} }
for _ in 0 .. nr_cpus - 1 {
go q.run()
}
time.sleep_ms(1000)
println('all done')
return q.parsed_ast_files
} }
// /////////////// // ///////////////
mut files := []ast.File{} mut files := []ast.File{}

View File

@ -15,7 +15,7 @@ pub mut:
modules []string // List of all modules registered by the application modules []string // List of all modules registered by the application
cflags []cflag.CFlag cflags []cflag.CFlag
redefined_fns []string redefined_fns []string
fn_gen_types map[string][]Type fn_gen_types map[string][]Type // for generic functions
} }
pub struct Fn { pub struct Fn {