1 //------------------------------------------------------------------------------
2 // GxB_Scalar_wait: wait for a scalar to complete
3 //------------------------------------------------------------------------------
4
5 // SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
6 // SPDX-License-Identifier: Apache-2.0
7
8 //------------------------------------------------------------------------------
9
10 // Finishes all work on a scalar, followed by an OpenMP flush.
11
12 #include "GB.h"
13
14 #define GB_FREE_ALL ;
15
GxB_Scalar_wait(GxB_Scalar * s)16 GrB_Info GxB_Scalar_wait // finish all work on a scalar
17 (
18 GxB_Scalar *s
19 )
20 {
21
22 //--------------------------------------------------------------------------
23 // check inputs
24 //--------------------------------------------------------------------------
25
26 #pragma omp flush
27 GB_WHERE ((*s), "GxB_Scalar_wait (&s)") ;
28 GB_RETURN_IF_NULL (s) ;
29 GB_RETURN_IF_NULL_OR_FAULTY (*s) ;
30
31 //--------------------------------------------------------------------------
32 // finish all pending work on the scalar
33 //--------------------------------------------------------------------------
34
35 if (GB_ANY_PENDING_WORK (*s))
36 {
37 GrB_Info info ;
38 GB_BURBLE_START ("GxB_Scalar_wait") ;
39 GB_OK (GB_Matrix_wait ((GrB_Matrix) (*s), "scalar", Context)) ;
40 GB_BURBLE_END ;
41 }
42
43 //--------------------------------------------------------------------------
44 // return result
45 //--------------------------------------------------------------------------
46
47 #pragma omp flush
48 return (GrB_SUCCESS) ;
49 }
50
51