summaryrefslogtreecommitdiff
path: root/lib/dec_and_lock.c
blob: e26278576b31148bd021a52c0980f921bfaa233a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <linux/export.h>
#include <linux/spinlock.h>
#include <linux/atomic.h>

/*
 * This is an implementation of the notion of "decrement a
 * reference count, and return locked if it decremented to zero".
 *
 * NOTE NOTE NOTE! This is _not_ equivalent to
 *
 *	if (atomic_dec_and_test(&atomic)) {
 *		spin_lock(&lock);
 *		return 1;
 *	}
 *	return 0;
 *
 * because the spin-lock and the decrement must be
 * "atomic".
 */
int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)
{
	/* Subtract 1 from counter unless that drops it to 0 (ie. it was 1) */
	if (atomic_add_unless(atomic, -1, 1))
		return 0;

	/* Otherwise do it the slow way */
	spin_lock(lock);
	if (atomic_dec_and_test(atomic))
		return 1;
	spin_unlock(lock);
	return 0;
}

EXPORT_SYMBOL(_atomic_dec_and_lock);
reoffice-24-2-1 Unnamed repository; edit this file to name it for gitweb.root
summaryrefslogtreecommitdiff
path: root/source
AgeCommit message (Expand)AuthorFilesLines
2018-01-10update translations for 6.0 rc2Christian Lohmaier1152-83636/+67632
2018-01-03Updated Slovenian translationAndras Timar19-235/+251
2017-12-21Updated Slovenian translationsAndras Timar1-13/+13
2017-12-20Updated Slovenian translationAndras Timar11-294/+4091
2017-12-20update translations for 6.0 rc1Christian Lohmaier1875-117341/+604955
2017-12-20Updated Slovenian translationAndras Timar27-1142/+1623
2017-12-18update translations for 6.0/masterChristian Lohmaier4166-354536/+699155
2017-12-12resurrect some translated strings via compendiumChristian Lohmaier2588-156024/+311864
2017-12-12update translationsChristian Lohmaier367-14115/+13078
2017-12-08Updated Slovenian translationsAndras Timar15-1542/+2259
2017-12-07update translations for 6.0 beta2Christian Lohmaier1714-380738/+445109
2017-12-03Updated Slovenian translationAndras Timar18-2721/+2936
2017-11-24Updated Slovenian translationAndras Timar17-591/+825
2017-11-24another set of translation updates for 6.0 beta1libreoffice-6-0-branch-pointChristian Lohmaier814-24823/+28475
2017-11-24remove hu-Hung as it doesn't contain any translation in the first placeChristian Lohmaier140-216230/+0
2017-11-24update sr and sr-Latn to current templatesChristian Lohmaier300-186003/+179863
2017-11-22update translations for 6.0 beta1Christian Lohmaier4986-3823908/+3945148
2017-11-21Updated Slovenian translationAndras Timar10-356/+356
2017-11-16Updated Slovenian translationAndras Timar25-655/+688
2017-11-06Updated Slovenian translationAndras Timar23-1734/+2381
2017-10-19make msgfmt happy re 'msgid' and 'msgstr' entries do not both end with '\n'Christian Lohmaier13-14/+13
2017-10-19update templates for 6.0.0 alpha1Christian Lohmaier