File tree Expand file tree Collapse file tree
docs/src/tutorials/algorithms Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ Threads.nthreads()
5353 global ids, my_lock
5454 Threads. lock (my_lock) do
5555 push! (ids, Threads. threadid ())
56+ return
5657 end
5758 sleep (1.0 )
5859 end
@@ -127,6 +128,7 @@ begin
127128 for i in 1 : 1_000
128129 lock (l) do
129130 x[] += 1
131+ return
130132 end
131133 end
132134 end
@@ -208,6 +210,7 @@ function dont_run_segfault_likely()
208210 optimize! (model)
209211 end
210212 model = models[1 ] # `model` is used outside the loop
213+ return
211214end
212215
213216# And indeed, running this code results in:
@@ -282,6 +285,7 @@ function a_good_way_to_use_threading()
282285 assert_is_solved_and_feasible (model)
283286 Threads. lock (my_lock) do
284287 push! (solutions, i => objective_value (model))
288+ return
285289 end
286290 end
287291 return solutions
@@ -335,6 +339,7 @@ function a_correct_way_to_build_with_multithreading()
335339 con = @build_constraint (x[i] <= i)
336340 Threads. lock (my_lock) do
337341 add_constraint (model, con)
342+ return
338343 end
339344 end
340345 return model
You can’t perform that action at this time.
0 commit comments