- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Unique key for shared memory at start...
Unique key for shared memory at start of simulation
Unique key for shared memory at start of simulation
Hello
I am trying to call an external C function which will generate unique key (for shared memory) at the start of simulation and then save it into a variable which will be accesible from submodels in my scheme. But I cant to find a way to call the function only one time at the start of simulation(when {time== 0 didnt work}) and then how to set it as global variable so other submodels can acces it. Thanks for reply:)
Re: Unique key for shared memory at start of simulation
pthread_once_t my_once = PTHREAD_ONCE_INIT;
Or possibly simpler would be to create an inner/outer external object since external objects are created only once. The external object itself could be the shared memory; no keys needed since you just pass around the same pointer to all functions.
- sjoelund.se
- 1700 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Unique key for shared memory at start...