aboutsummaryrefslogtreecommitdiffstats
path: root/ctrl/sysrepo-plugins/hicn-light/plugin/model/tlock.c
diff options
context:
space:
mode:
Diffstat (limited to 'ctrl/sysrepo-plugins/hicn-light/plugin/model/tlock.c')
-rw-r--r--ctrl/sysrepo-plugins/hicn-light/plugin/model/tlock.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/ctrl/sysrepo-plugins/hicn-light/plugin/model/tlock.c b/ctrl/sysrepo-plugins/hicn-light/plugin/model/tlock.c
index 2f7b11efa..ba788d3a0 100644
--- a/ctrl/sysrepo-plugins/hicn-light/plugin/model/tlock.c
+++ b/ctrl/sysrepo-plugins/hicn-light/plugin/model/tlock.c
@@ -1,21 +1,16 @@
-#include"tlock.h"
+#include "tlock.h"
-
-void Ticket_init ( int Lock_Number , long int init ){
-
-__atomic_store( &En[Lock_Number] , &init , __ATOMIC_SEQ_CST );
-__atomic_store( &De[Lock_Number] , &init , __ATOMIC_SEQ_CST );
-//En[Lock_Number]=init;
-//De[Lock_Number]=init;
+void Ticket_init(int Lock_Number, long int init) {
+ __atomic_store(&En[Lock_Number], &init, __ATOMIC_SEQ_CST);
+ __atomic_store(&De[Lock_Number], &init, __ATOMIC_SEQ_CST);
+ // En[Lock_Number]=init;
+ // De[Lock_Number]=init;
}
-void Ticket_Lock(int Lock_Number ){
-
- int my_ticket = __sync_fetch_and_add(&En[Lock_Number] , 1 );
- while ( my_ticket != De[ Lock_Number ] ) {};
-
+void Ticket_Lock(int Lock_Number) {
+ int my_ticket = __sync_fetch_and_add(&En[Lock_Number], 1);
+ while (my_ticket != De[Lock_Number]) {
+ };
}
-void Ticket_Unlock(int Lock_Number ){
-De[Lock_Number]++;
-}
+void Ticket_Unlock(int Lock_Number) { De[Lock_Number]++; }