mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-23 10:39:16 +00:00
added isc_quota_attach(), isc_quota_detach()
This commit is contained in:
parent
16804ba3b7
commit
8c36d7eeb9
@ -87,6 +87,21 @@ isc_quota_release(isc_quota_t *quota);
|
|||||||
* Release one unit of quota.
|
* Release one unit of quota.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
isc_result_t
|
||||||
|
isc_quota_attach(isc_quota_t *quota, isc_quota_t **p);
|
||||||
|
/*
|
||||||
|
* Like isc_quota_reserve, and also attaches '*p' to the
|
||||||
|
* quota if successful.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
isc_quota_detach(isc_quota_t **p);
|
||||||
|
/*
|
||||||
|
* Like isc_quota_release, and also detaches '*p' from the
|
||||||
|
* quota.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
ISC_LANG_ENDDECLS
|
ISC_LANG_ENDDECLS
|
||||||
|
|
||||||
#endif /* ISC_QUOTA_H */
|
#endif /* ISC_QUOTA_H */
|
||||||
|
@ -55,4 +55,22 @@ isc_quota_release(isc_quota_t *quota) {
|
|||||||
UNLOCK("a->lock);
|
UNLOCK("a->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isc_result_t
|
||||||
|
isc_quota_attach(isc_quota_t *quota, isc_quota_t **p)
|
||||||
|
{
|
||||||
|
isc_result_t result;
|
||||||
|
INSIST(p != NULL && *p == NULL);
|
||||||
|
result = isc_quota_reserve(quota);
|
||||||
|
if (result != ISC_R_SUCCESS)
|
||||||
|
return (result);
|
||||||
|
*p = quota;
|
||||||
|
return (ISC_R_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
isc_quota_detach(isc_quota_t **p)
|
||||||
|
{
|
||||||
|
INSIST(p != NULL && *p != NULL);
|
||||||
|
isc_quota_release(*p);
|
||||||
|
*p = NULL;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user