openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

lock.c (664B)


      1 /* 
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6  *
      7  * File:        lock.c
      8  * Purpose:     SAL Global lock
      9  */
     10 
     11 #include <sal/core/libc.h>
     12 #include <sal/core/sync.h>
     13 
     14 /* SAL Global Lock */
     15 sal_mutex_t                     sal_global_lock = NULL;
     16 
     17 int
     18 sal_global_lock_init(void)
     19 {
     20     /* Initialize CM System lock */
     21     if (sal_global_lock == NULL) {
     22         sal_global_lock = sal_mutex_create("SAL Global Lock");
     23         if (sal_global_lock == NULL) {
     24             return -1;
     25         }
     26     }
     27 
     28     return 0;
     29 }