diff --git a/ml.cpp b/ml.cpp index f02b0d2..0c09547 100644 --- a/ml.cpp +++ b/ml.cpp @@ -1954,7 +1954,7 @@ MlValue thread_create(std::vector args, MlEnvironment &env) { for (size_t i = 0; i < args.size(); i++) MlValue acc = args[i].eval(env); } catch (std::exception &e) { - std::cerr << "thread exception: " << e.what() << std::endl; + std::cerr << "thread_create exception: " << e.what() << std::endl; throw e; } }; @@ -1974,15 +1974,15 @@ MlValue thread_create(std::vector args, MlEnvironment &env) { } MlValue thread_under_lock(std::vector args, MlEnvironment &env) { - if (args.size() != 2) - throw MlError(MlValue("thread_under_lock", thread_under_lock), env, args.size() > 2 ? TOO_MANY_ARGS : TOO_FEW_ARGS); + if (args.size() < 2) + throw MlError(MlValue("thread_under_lock", thread_under_lock), env, TOO_FEW_ARGS); if (args[0].as_string() != "ilock") throw MlError(MlValue("thread_under_lock", thread_under_lock), env, UNKNOWN_ERROR); std::lock_guard lockGuard(interpreter_mutex); MlValue acc; - for (size_t i = 0; i < args.size(); i++) + for (size_t i = 1; i < args.size(); i++) acc = args[i].eval(env); return acc;