|
| 1 | +/* |
| 2 | +*+ |
| 3 | +* Name: |
| 4 | +* datNolock |
| 5 | +
|
| 6 | +* Purpose: |
| 7 | +* Indicate that an object should be used without checking its lock. |
| 8 | +
|
| 9 | +* Language: |
| 10 | +* Starlink ANSI C |
| 11 | +
|
| 12 | +* Type of Module: |
| 13 | +* Library routine |
| 14 | +
|
| 15 | +* Invocation: |
| 16 | +* datNolock( HDSLoc *locator, int *status ); |
| 17 | +
|
| 18 | +* Arguments: |
| 19 | +* locator = HDSLoc * (Given) |
| 20 | +* Locator to the object that is to be modified. |
| 21 | +* status = int* (Given and Returned) |
| 22 | +* Pointer to global status. |
| 23 | +
|
| 24 | +* Description: |
| 25 | +* By default, every HDS function will check that the supplied locator |
| 26 | +* is locked for use by the current thread before using it, and issue |
| 27 | +* an error report if it is not suitably locked. In some cases however, |
| 28 | +* this check is not required and can cause problems. This function can |
| 29 | +* be used to supres the check when required. It stores a flag with the |
| 30 | +* given locator indicating that no such checks should be performed |
| 31 | +* before using the locator. |
| 32 | +* |
| 33 | +* For instance, objects created within Fortran code may require this |
| 34 | +* flag to be set. |
| 35 | +
|
| 36 | +* Authors: |
| 37 | +* DSB: David S Berry (DSB) |
| 38 | +* {enter_new_authors_here} |
| 39 | +
|
| 40 | +* History: |
| 41 | +* 9-OCT-2017 (DSB): |
| 42 | +* Initial version |
| 43 | +* {enter_further_changes_here} |
| 44 | +
|
| 45 | +* Copyright: |
| 46 | +* Copyright (C) 2017 East Asian Observatory. |
| 47 | +* All Rights Reserved. |
| 48 | +
|
| 49 | +* Licence: |
| 50 | +* Redistribution and use in source and binary forms, with or |
| 51 | +* without modification, are permitted provided that the following |
| 52 | +* conditions are met: |
| 53 | +* |
| 54 | +* - Redistributions of source code must retain the above copyright |
| 55 | +* notice, this list of conditions and the following disclaimer. |
| 56 | +* |
| 57 | +* - Redistributions in binary form must reproduce the above |
| 58 | +* copyright notice, this list of conditions and the following |
| 59 | +* disclaimer in the documentation and/or other materials |
| 60 | +* provided with the distribution. |
| 61 | +* |
| 62 | +* - Neither the name of the {organization} nor the names of its |
| 63 | +* contributors may be used to endorse or promote products |
| 64 | +* derived from this software without specific prior written |
| 65 | +* permission. |
| 66 | +* |
| 67 | +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND |
| 68 | +* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, |
| 69 | +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 70 | +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 71 | +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
| 72 | +* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 73 | +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 74 | +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
| 75 | +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
| 76 | +* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 77 | +* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 78 | +* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| 79 | +* THE POSSIBILITY OF SUCH DAMAGE. |
| 80 | +
|
| 81 | +* Bugs: |
| 82 | +* {note_any_bugs_here} |
| 83 | +*- |
| 84 | +*/ |
| 85 | + |
| 86 | +#include "sae_par.h" |
| 87 | +#include "dat1.h" |
| 88 | +#include "hds.h" |
| 89 | + |
| 90 | +int datNolock( HDSLoc *locator, int *status ) { |
| 91 | + |
| 92 | +/* Check inherited status. */ |
| 93 | + if (*status != SAI__OK) return *status; |
| 94 | + |
| 95 | +/* Validate input locator. */ |
| 96 | + dat1ValidateLocator( "datNolock", 0, locator, 0, status ); |
| 97 | + |
| 98 | +/* Check we can de-reference "locator" safely. */ |
| 99 | + if( *status == SAI__OK ) { |
| 100 | + |
| 101 | +/* Set the flag. */ |
| 102 | + locator->handle->docheck = 0; |
| 103 | + } |
| 104 | + |
| 105 | + return *status; |
| 106 | +} |
| 107 | + |
0 commit comments