Skip to content

Commit

Permalink
Merge pull request #249 from lf-lang/enclave-fixes
Browse files Browse the repository at this point in the history
Critical sections enabled outside of the context of a reactor
  • Loading branch information
lhstrh authored Jul 12, 2023
2 parents 294fbb2 + ac3f649 commit df0f4a5
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 369 deletions.
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

0 comments on commit df0f4a5

Please # to comment.