-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C API: Current generated code is not reentrant and not thread safe #894
Comments
Dear Didier, thanks for the notice. I will adjust the code generator setting and regenerate the C-code now. Best regards, |
Well since it change completely the API and we already have changed the implementation, maybe we can wait for the other partners approval since other may be affected. BTW, I guess @BerndHecklele already have generated a special version for us (just be sure we have the tcp/ip code for dmi communication) thanks a lot, Didier |
Dear Didier, my assumption was, that you were talking about the code I generated yesterday located in the srcAndBinary repository under: Green openETCS Non-Vital Demonstrator/Source Code/Source Code ETCS Onboard Unit System/Generated_Code/KCG-ERSA/ Is the interface in the source code in this directory according your expectations? Stefan |
Sorry, my fault, I was still looking in Green openETCS Non-Vital Demonstrator/Source Code/Source Code ETCS Onboard Unit System/Generated_Code/KCG-release. The "ERSA" version is reentrant and is more appropriate for us. Didier |
Anyway, avoiding like hell global non-const variables is always safer, so I guess code generated in "release" should also follow that |
Dear all,
It is a bit unfortunate that all scade API use global extern variables (API_fromxx, ....), it make the whole code not re-entrant and will definitively disallow us to have several "EVC" instance in the same process, which may have been useful in the case of a full traffic simulation, with many train at the same time.
The generated code is also a bit fragile in a multithreaded environment as special care need to be taken to be sure to not access this global extern variable in different thread at the same time.
The previous paradigm ( using a rentrant EVC operator like outEVCData = EVC( inEVCData ) ) was safer and more versatile.
Best regards,
Didier
The text was updated successfully, but these errors were encountered: