Home | History | Annotate | Download | only in compiler
      1 //
      2 // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
      3 // Use of this source code is governed by a BSD-style license that can be
      4 // found in the LICENSE file.
      5 //
      6 
      7 //
      8 // This file contains the nspr specific functions
      9 //
     10 #include "compiler/osinclude.h"
     11 
     12 //
     13 // Thread Local Storage Operations
     14 //
     15 OS_TLSIndex OS_AllocTLSIndex()
     16 {
     17     PRUintn index;
     18     PRStatus status = PR_NewThreadPrivateIndex(&index, NULL);
     19 
     20     if (status) {
     21         assert(0 && "OS_AllocTLSIndex(): Unable to allocate Thread Local Storage");
     22         return OS_INVALID_TLS_INDEX;
     23     }
     24 
     25     return index;
     26 }
     27 
     28 bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue)
     29 {
     30     if (nIndex == OS_INVALID_TLS_INDEX) {
     31         assert(0 && "OS_SetTLSValue(): Invalid TLS Index");
     32         return false;
     33     }
     34 
     35     return PR_SetThreadPrivate(nIndex, lpvValue) == 0;
     36 }
     37 
     38 bool OS_FreeTLSIndex(OS_TLSIndex nIndex)
     39 {
     40     // Can't delete TLS keys with nspr
     41     return true;
     42 }
     43 
     44