1*2a5d5078SSiva Chandra Reddy //===-- Linux implementation of the pthread_mutex_destroy function --------===//
2*2a5d5078SSiva Chandra Reddy //
3*2a5d5078SSiva Chandra Reddy // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*2a5d5078SSiva Chandra Reddy // See https://llvm.org/LICENSE.txt for license information.
5*2a5d5078SSiva Chandra Reddy // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*2a5d5078SSiva Chandra Reddy //
7*2a5d5078SSiva Chandra Reddy //===----------------------------------------------------------------------===//
8*2a5d5078SSiva Chandra Reddy 
9*2a5d5078SSiva Chandra Reddy #include "pthread_mutex_destroy.h"
10*2a5d5078SSiva Chandra Reddy 
11*2a5d5078SSiva Chandra Reddy #include "src/__support/common.h"
12*2a5d5078SSiva Chandra Reddy #include "src/__support/threads/mutex.h"
13*2a5d5078SSiva Chandra Reddy 
14*2a5d5078SSiva Chandra Reddy #include <pthread.h>
15*2a5d5078SSiva Chandra Reddy 
16*2a5d5078SSiva Chandra Reddy namespace __llvm_libc {
17*2a5d5078SSiva Chandra Reddy 
18*2a5d5078SSiva Chandra Reddy LLVM_LIBC_FUNCTION(int, pthread_mutex_destroy, (pthread_mutex_t * mutex)) {
19*2a5d5078SSiva Chandra Reddy   auto *m = reinterpret_cast<Mutex *>(mutex);
20*2a5d5078SSiva Chandra Reddy   Mutex::destroy(m);
21*2a5d5078SSiva Chandra Reddy   // TODO: When the Mutex class supports all the possible error conditions
22*2a5d5078SSiva Chandra Reddy   // return the appropriate error value here.
23*2a5d5078SSiva Chandra Reddy   return 0;
24*2a5d5078SSiva Chandra Reddy }
25*2a5d5078SSiva Chandra Reddy 
26*2a5d5078SSiva Chandra Reddy } // namespace __llvm_libc
27