Skip to content

Disposable.blockedGet(Timeout) 方法出现问题 #503

@MOldtime

Description

@MOldtime

版本:6.7.0
在之前的版本,这个方法传入Timeout后,是在规定时间内没有收到结果, 才会返回null,在规定时间前返回都会立即响应。目前传入TimeOut后会等待超时后才会收到结果

Code:

var sum = threads.disposable();
//启动子线程计算
threads.start(function () {
	var s = 0;
	//从1加到10000
	for (var i = 1; i <= 10000; i++) {
		s += i;
	}
	//通知主线程接收结果
	sum.setAndNotify(s);
});
//blockedGet()用于等待结果
let result = sum.blockedGet(10000) // 这里不填timeiout和填了的执行时长不一致
console.log("sum = " + result);

Log:

08:32:56.996/V: 开始运行 [$remote/test3.js].
08:32:57.018/D: sum = 50005000
08:32:57.024/V: [$remote/test3.js] 运行结束 (用时 0.024 秒)

08:33:32.090/V: 开始运行 [$remote/test3.js].
08:33:42.095/D: sum = 50005000
08:33:42.102/V: [$remote/test3.js] 运行结束 (用时 10.006 秒)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions