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

Critical sections enabled outside of the context of a reactor #249

Merged
merged 6 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions core/federated/RTI/rti_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,11 @@ lf_mutex_t rti_mutex;
lf_cond_t received_start_times;
lf_cond_t sent_start_time;

/**
* Enter a critical section where logical time and the event queue are guaranteed
* to not change unless they are changed within the critical section.
* this can be implemented by disabling interrupts.
* Users of this function must ensure that lf_init_critical_sections() is
* called first and that lf_critical_section_exit() is called later.
* @return 0 on success, platform-specific error number otherwise.
*/
extern int lf_critical_section_enter() {
extern int lf_critical_section_enter(environment_t* env) {
return lf_mutex_lock(&rti_mutex);
}

/**
* Exit the critical section entered with lf_lock_time().
* @return 0 on success, platform-specific error number otherwise.
*/
extern int lf_critical_section_exit() {
extern int lf_critical_section_exit(environment_t* env) {
return lf_mutex_unlock(&rti_mutex);
}

Expand Down
6 changes: 4 additions & 2 deletions core/federated/RTI/rti_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,17 @@ typedef struct federation_rti_t {
* this can be implemented by disabling interrupts.
* Users of this function must ensure that lf_init_critical_sections() is
* called first and that lf_critical_section_exit() is called later.
* @param env Ignored (present for compatibility).
* @return 0 on success, platform-specific error number otherwise.
*/
extern int lf_critical_section_enter();
extern int lf_critical_section_enter(environment_t* env);

/**
* Exit the critical section entered with lf_lock_time().
* @param env Ignored (present for compatibility).
* @return 0 on success, platform-specific error number otherwise.
*/
extern int lf_critical_section_exit();
extern int lf_critical_section_exit(environment_t* env);

/**
* Create a server and enable listening for socket connections.
Expand Down
Loading