Skip to content

Commit

Permalink
open memmap only after "data valid event"
Browse files Browse the repository at this point in the history
  • Loading branch information
kutu committed Sep 12, 2021
1 parent b5c1fc4 commit ca25b66
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions irsdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
except ImportError:
from yaml import SafeLoader as YamlSafeLoader

VERSION = '1.3.0'
VERSION = '1.3.1'

SIM_STATUS_URL = 'http://127.0.0.1:32034/get_sim_status?object=simStatus'

Expand Down Expand Up @@ -396,7 +396,12 @@ def var_headers_names(self):
return self.__var_headers_names

def startup(self, test_file=None, dump_to=None):
if test_file is None and not self._check_sim_status():
if test_file is None:
if not self._check_sim_status():
return False
self._dataValidEvent = ctypes.windll.kernel32.OpenEventW(0x00100000, False, DATAVALIDEVENTNAME)
if not self._wait_valid_data_event():
self._dataValidEvent = None
return False

if self._shared_mem is None:
Expand All @@ -407,11 +412,6 @@ def startup(self, test_file=None, dump_to=None):
else:
self._shared_mem = mmap.mmap(0, MEMMAPFILESIZE, MEMMAPFILE, access=mmap.ACCESS_READ)

if not self._dataValidEvent and not self.__is_using_test_file:
self._dataValidEvent = ctypes.windll.kernel32.OpenEventW(0x00100000, False, DATAVALIDEVENTNAME)
if not self._wait_valid_data_event():
return False

if self._shared_mem:
if dump_to:
with open(dump_to, 'wb') as f:
Expand Down

0 comments on commit ca25b66

Please sign in to comment.