This macro initializes a critical section lock at runtime. This macro basically creates a member of the initialization list, including the trailing comma. If the lock is unnecessary because the architecture is single-core, this macro will not do anything. This is incompatible with a lock created by DEFINE_CRIT_SECTION_LOCK_STATIC from above. Example usage:
{c}
...
#include "os/critical_section.h"
...
typedef struct protected_struct_t {
int member1;
DECLARE_CRIT_SECTION_LOCK_IN_STRUCT(my_lock)
int another_member;
};
...
protected_struct_t my_protected;
INIT_CRIT_SECTION_LOCK_IN_STRUCT(&(my_protected.my_lock));
};