Skip to content
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

Code generation problems #3

Open
janwilmans opened this issue Nov 2, 2017 · 2 comments
Open

Code generation problems #3

janwilmans opened this issue Nov 2, 2017 · 2 comments

Comments

@janwilmans
Copy link
Owner

janwilmans commented Nov 2, 2017

All tests were done on the version of Dezyne downloaded from the Dezyne website at Nov 2. 2017.
image

Generated using dzn service version 2.5.3.

without TSS (thread-safe-shell)

dzn code -l c++ -s AlarmSystem Alarm.dzn

generated two files:
Alarm.hh and Alarm.cc

In Alarm.hh:

////////////////////////////////////////////////////////////////////////////////
// #ifndef ALARMSYSTEM_HH
// #define ALARMSYSTEM_HH

//interface includes
#include "Alarm.hh"
#include "Alarm.hh"
#include "Alarm.hh"

While this does not actually cause any problems, it is a little weird to include the same files multiple times.

with TSS (thread-safe-shell)

dzn code -l c++ -s AlarmSystem Alarm.dzn

generated two files:
Alarm.hh and Alarm.cc

However, Alarm.cc tried to:

#include "AlarmSystem.hh"

So this does not compile.

with TSS (thread-safe-shell), but providing the wrong component as System

dzn code -l c++ -s Alarm Alarm.dzn

generated two files:
Alarm.hh and Alarm.cc

However, the thread-safe-shell is not actually generated at all!

@janwilmans
Copy link
Owner Author

janwilmans commented Nov 2, 2017

6072f6b is generated with TSS.

1632 is the main thread
1504 is a second worker thread that triggers the sensor.

Why are the Detected and siren on action not deferred to the pump thread?

<external>.console.arm -> .alarm.console.arm [enter] [Disarmed, false] (tid: 1632)
sensor enabled (tid: 1632)
<external>.console.arm <- .alarm.console.arm [leave] [Armed, false] (return) (tid: 1632)
<external>.sensor.triggered -> .alarm.sensor.triggered [deferred] [Armed, false] (tid: 1504)
Detected! (tid: 1504)
siren on! (tid: 1504) 

janwilmans added a commit that referenced this issue Jun 11, 2018
@janwilmans
Copy link
Owner Author

the problem is due to a user error where it was actually possible to call the non-threadsafe methods from outside the threadsafe shell (because those std::function's where public (part of a struct.) it would be good to make them private so this becomes hard to use incorrectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant