python WaitForMultipleObjects函数返回值为什么会是258

报错最根源的地方

def _recv_bytes(self, maxsize=None):
    if self._got_empty_message:
        self._got_empty_message = False
        return io.BytesIO()
    else:
        bsize = 128 if maxsize is None else min(maxsize, 128)
        try:
            ov, err = _winapi.ReadFile(self._handle, bsize,
                                        overlapped=True)
            try:
                if err == _winapi.ERROR_IO_PENDING:
                    print('15')
  here→→→→      waitres = _winapi.WaitForMultipleObjects(
                        [ov.event], False, 500)
                    print('16')
                    print(waitres)
                    print(WAIT_OBJECT_0)
                    assert waitres == WAIT_OBJECT_0
            except:
                ov.cancel()
                raise
            finally:
                nread, err = ov.GetOverlappedResult(True)
                if err == 0:
                    f = io.BytesIO()
                    f.write(ov.getbuffer())
                    return f
                elif err == _winapi.ERROR_MORE_DATA:
                    return self._get_more_data(ov, maxsize)
        except OSError as e:
            if e.winerror == _winapi.ERROR_BROKEN_PIPE:
                raise EOFError
            else:
                raise
    raise RuntimeError("shouldn't get here; expected KeyboardInterrupt")

 

 

 

 

Traceback (most recent call last):
  File "demo.py", line 139, in <module>
    training.train()
  File "C:\Users\12874\bishe\conet\trainer.py", line 168, in train
    self.train_epoch()
  File "C:\Users\12874\bishe\conet\trainer.py", line 59, in train_epoch
    for batch_idx, (data, target, depth, edge) in enumerate(self.train_loader):
  File "C:\Users\12874\anaconda3\envs\pytorch\lib\site-packages\torch\utils\data\dataloader.py", line 518, in __next__
    data = self._next_data()
  File "C:\Users\12874\anaconda3\envs\pytorch\lib\site-packages\torch\utils\data\dataloader.py", line 1189, in _next_data
    idx, data = self._get_data()
  File "C:\Users\12874\anaconda3\envs\pytorch\lib\site-packages\torch\utils\data\dataloader.py", line 1153, in _get_data
    success, data = self._try_get_data()
  File "C:\Users\12874\anaconda3\envs\pytorch\lib\site-packages\torch\utils\data\dataloader.py", line 989, in _try_get_data
    data = self._data_queue.get(timeout=timeout)
  File "C:\Users\12874\anaconda3\envs\pytorch\lib\multiprocessing\queues.py", line 110, in get
    res = self._recv_bytes()
  File "C:\Users\12874\anaconda3\envs\pytorch\lib\multiprocessing\connection.py", line 217, in recv_bytes
    buf = self._recv_bytes(maxlength)
  File "C:\Users\12874\anaconda3\envs\pytorch\lib\multiprocessing\connection.py", line 309, in _recv_bytes
    [ov.event], False, 500)
 

 

print出来print('16')

             print(waitres) 的值是258

            print(WAIT_OBJECT_0) 的值是0

是哪里出的问题?

waitres = _winapi.WaitForMultipleObjects(
                        [ov.event], False, 500)

这里的500是我把原代码中INFINITE改了,如果不改程序就像死锁一样,没有结果出来,也不停止也不报错

你好,我是有问必答小助手,非常抱歉,本次您提出的有问必答问题,技术专家团超时未为您做出解答

本次提问扣除的有问必答次数,将会以问答VIP体验卡(1次有问必答机会、商城购买实体图书享受95折优惠)的形式为您补发到账户。

​​​​因为有问必答VIP体验卡有效期仅有1天,您在需要使用的时候【私信】联系我,我会为您补发。