Home
last modified time | relevance | path

Searched refs:lock (Results 1 – 25 of 1006) sorted by relevance

12345678910>>...41

/openbsd-src/usr.sbin/unbound/util/
H A Dlocks.h86 #define lock_protect(lock, area, size) /* nop */ argument
87 #define lock_unprotect(lock, area) /* nop */ argument
88 #define lock_get_mem(lock) (0) /* nothing */ argument
100 #define lock_basic_init(lock) LOCKRET(pthread_mutex_init(lock, NULL)) argument
101 #define lock_basic_destroy(lock) LOCKRET(pthread_mutex_destroy(lock)) argument
102 #define lock_basic_lock(lock) LOCKRET(pthread_mutex_lock(lock)) argument
103 #define lock_basic_unlock(lock) LOCKRET(pthread_mutex_unlock(lock)) argument
108 #define lock_rw_init(lock) LOCKRET(pthread_mutex_init(lock, NULL)) argument
109 #define lock_rw_destroy(lock) LOCKRET(pthread_mutex_destroy(lock)) argument
110 #define lock_rw_rdlock(lock) LOCKRET(pthread_mutex_lock(lock)) argument
[all …]
/openbsd-src/sbin/unwind/libunbound/util/
H A Dlocks.h86 #define lock_protect(lock, area, size) /* nop */ argument
87 #define lock_unprotect(lock, area) /* nop */ argument
88 #define lock_get_mem(lock) (0) /* nothing */ argument
100 #define lock_basic_init(lock) LOCKRET(pthread_mutex_init(lock, NULL)) argument
101 #define lock_basic_destroy(lock) LOCKRET(pthread_mutex_destroy(lock)) argument
102 #define lock_basic_lock(lock) LOCKRET(pthread_mutex_lock(lock)) argument
103 #define lock_basic_unlock(lock) LOCKRET(pthread_mutex_unlock(lock)) argument
108 #define lock_rw_init(lock) LOCKRET(pthread_mutex_init(lock, NULL)) argument
109 #define lock_rw_destroy(lock) LOCKRET(pthread_mutex_destroy(lock)) argument
110 #define lock_rw_rdlock(lock) LOCKRET(pthread_mutex_lock(lock)) argument
[all …]
/openbsd-src/lib/librthread/
H A Drthread_rwlock_compat.c38 pthread_rwlock_t lock; in pthread_rwlock_init() local
40 lock = calloc(1, sizeof(*lock)); in pthread_rwlock_init()
41 if (!lock) in pthread_rwlock_init()
43 lock->lock = _SPINLOCK_UNLOCKED; in pthread_rwlock_init()
44 TAILQ_INIT(&lock->writers); in pthread_rwlock_init()
46 *lockp = lock; in pthread_rwlock_init()
55 pthread_rwlock_t lock; in pthread_rwlock_destroy() local
58 lock = *lockp; in pthread_rwlock_destroy()
59 if (lock) { in pthread_rwlock_destroy()
60 if (lock->readers || !TAILQ_EMPTY(&lock->writers)) { in pthread_rwlock_destroy()
[all …]
H A Drthread_spin_lock.c26 pthread_spin_init(pthread_spinlock_t *lock, int pshared) in pthread_spin_init() argument
30 if (lock == NULL) in pthread_spin_init()
40 l->lock = _SPINLOCK_UNLOCKED; in pthread_spin_init()
41 *lock = l; in pthread_spin_init()
46 pthread_spin_destroy(pthread_spinlock_t *lock) in pthread_spin_destroy() argument
48 if (lock == NULL || *lock == NULL) in pthread_spin_destroy()
51 if ((*lock)->owner != NULL) in pthread_spin_destroy()
54 free(*lock); in pthread_spin_destroy()
55 *lock = NULL; in pthread_spin_destroy()
60 pthread_spin_trylock(pthread_spinlock_t *lock) in pthread_spin_trylock() argument
[all …]
/openbsd-src/usr.sbin/unbound/testcode/
H A Dchecklocks.c86 static void lock_error(struct checked_lock* lock, const char* func,
90 static void lock_error(struct checked_lock* lock, in lock_error() argument
94 log_err("Created at %s %s:%d", lock->create_func, in lock_error()
95 lock->create_file, lock->create_line); in lock_error()
96 if(lock->holder_func && lock->holder_file) in lock_error()
97 log_err("Previously %s %s:%d", lock->holder_func, in lock_error()
98 lock->holder_file, lock->holder_line); in lock_error()
101 (lock->type==check_lock_mutex)?"mutex": ( in lock_error()
102 (lock->type==check_lock_spinlock)?"spinlock": ( in lock_error()
103 (lock->type==check_lock_rwlock)?"rwlock": "badtype")), err); in lock_error()
[all …]
H A Dchecklocks.h126 pthread_mutex_t lock; member
189 void lock_protect(void* lock, void* area, size_t size);
197 void lock_unprotect(void* lock, void* area);
204 size_t lock_get_mem(void* lock);
225 void checklock_init(enum check_lock_type type, struct checked_lock** lock,
236 void checklock_destroy(enum check_lock_type type, struct checked_lock** lock,
247 void checklock_rdlock(enum check_lock_type type, struct checked_lock* lock,
258 void checklock_wrlock(enum check_lock_type type, struct checked_lock* lock,
269 void checklock_lock(enum check_lock_type type, struct checked_lock* lock,
280 void checklock_unlock(enum check_lock_type type, struct checked_lock* lock,
[all …]
H A Dlock_verify.c94 struct order_lock* lock; member
252 ref->lock = prev; in read_lock()
290 visit->lock->id.thr, visit->lock->id.instance, in found_cycle()
291 visit->lock->create_file, visit->lock->create_line); in found_cycle()
296 p->lock->dfs_next?p->lock->dfs_next->lock:visit->lock; in found_cycle()
303 p = p->lock->dfs_next; in found_cycle()
304 if(p && p->lock == visit->lock) in found_cycle()
314 if(p->lock == visit->lock) in detect_cycle()
316 p = p->lock->dfs_next; in detect_cycle()
338 if(!visit->lock->visited) in search_cycle()
[all …]
/openbsd-src/sys/kern/
H A Dvfs_lockf.c176 struct lockf *lock; in lf_alloc() local
186 lock = pool_get(&lockf_pool, PR_WAITOK); in lf_alloc()
187 lock->lf_uid = uid; in lf_alloc()
188 return (lock); in lf_alloc()
192 lf_free(struct lockf *lock) in lf_free() argument
198 LFPRINT(("lf_free", lock), DEBUG_LINK); in lf_free()
200 KASSERT(TAILQ_EMPTY(&lock->lf_blkhd)); in lf_free()
202 ls_rele(lock->lf_state); in lf_free()
204 uip = uid_find(lock->lf_uid); in lf_free()
207 pool_put(&lockf_pool, lock); in lf_free()
[all …]
/openbsd-src/gnu/gcc/libgomp/config/posix95/
H A Dlock.c38 omp_init_lock (omp_lock_t *lock) in omp_init_lock() argument
40 pthread_mutex_init (lock, NULL); in omp_init_lock()
44 omp_destroy_lock (omp_lock_t *lock) in omp_destroy_lock() argument
46 pthread_mutex_destroy (lock); in omp_destroy_lock()
50 omp_set_lock (omp_lock_t *lock) in omp_set_lock() argument
52 pthread_mutex_lock (lock); in omp_set_lock()
56 omp_unset_lock (omp_lock_t *lock) in omp_unset_lock() argument
58 pthread_mutex_unlock (lock); in omp_unset_lock()
62 omp_test_lock (omp_lock_t *lock) in omp_test_lock() argument
64 return pthread_mutex_trylock (lock) == 0; in omp_test_lock()
[all …]
/openbsd-src/sys/dev/pci/drm/include/linux/
H A Dww_mutex.h88 ww_mutex_init(struct ww_mutex *lock, struct ww_class *ww_class) { in ww_mutex_init() argument
89 mtx_init(&lock->base, IPL_NONE); in ww_mutex_init()
90 lock->acquired = 0; in ww_mutex_init()
91 lock->ctx = NULL; in ww_mutex_init()
92 lock->owner = NULL; in ww_mutex_init()
96 ww_mutex_is_locked(struct ww_mutex *lock) { in ww_mutex_is_locked() argument
98 mtx_enter(&lock->base); in ww_mutex_is_locked()
99 if (lock->acquired > 0) res = true; in ww_mutex_is_locked()
100 mtx_leave(&lock->base); in ww_mutex_is_locked()
108 ww_mutex_trylock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx) { in ww_mutex_trylock() argument
[all …]
H A Dcompletion.h28 struct mutex lock; member
38 mtx_init(&x->lock, IPL_TTY); in init_completion()
54 mtx_enter(&x->lock); in wait_for_completion_timeout()
56 ret = msleep(x, &x->lock, 0, "wfct", timo); in wait_for_completion_timeout()
58 mtx_leave(&x->lock); in wait_for_completion_timeout()
65 mtx_leave(&x->lock); in wait_for_completion_timeout()
75 mtx_enter(&x->lock); in wait_for_completion()
77 msleep_nsec(x, &x->lock, 0, "wfcom", INFSLP); in wait_for_completion()
81 mtx_leave(&x->lock); in wait_for_completion()
91 mtx_enter(&x->lock); in wait_for_completion_interruptible()
[all …]
H A Dlockdep.h14 #define might_lock(lock) argument
15 #define might_lock_nested(lock, subc) argument
17 #define lockdep_assert_held(lock) do { (void)(lock); } while(0) argument
18 #define lockdep_assert_held_once(lock) do { (void)(lock); } while(0) argument
19 #define lockdep_assert_once(lock) do { (void)(lock); } while(0) argument
20 #define lockdep_assert_not_held(lock) do { (void)(lock); } while(0) argument
22 #define lock_acquire(lock, a, b, c, d, e, f) argument
23 #define lock_release(lock, a) argument
24 #define lock_acquire_shared_recursive(lock, a, b, c, d) argument
30 #define lockdep_is_held(lock) 0 argument
[all …]
/openbsd-src/sys/dev/pci/drm/
H A Ddrm_lock.c63 volatile unsigned int *lock = &lock_data->hw_lock->lock; in drm_lock_take() local
67 old = *lock; in drm_lock_take()
75 prev = cmpxchg(lock, old, new); in drm_lock_take()
112 volatile unsigned int *lock = &lock_data->hw_lock->lock; in drm_lock_transfer() local
116 old = *lock; in drm_lock_transfer()
118 prev = cmpxchg(lock, old, new); in drm_lock_transfer()
127 volatile unsigned int *lock = &lock_data->hw_lock->lock; in drm_legacy_lock_free() local
139 old = *lock; in drm_legacy_lock_free()
141 prev = cmpxchg(lock, old, new); in drm_legacy_lock_free()
168 struct drm_lock *lock = data; in drm_legacy_lock() local
[all …]
/openbsd-src/gnu/gcc/libgomp/config/posix/
H A Dlock.c47 omp_init_lock (omp_lock_t *lock) in omp_init_lock() argument
49 pthread_mutex_init (lock, NULL); in omp_init_lock()
53 omp_destroy_lock (omp_lock_t *lock) in omp_destroy_lock() argument
55 pthread_mutex_destroy (lock); in omp_destroy_lock()
59 omp_set_lock (omp_lock_t *lock) in omp_set_lock() argument
61 pthread_mutex_lock (lock); in omp_set_lock()
65 omp_unset_lock (omp_lock_t *lock) in omp_unset_lock() argument
67 pthread_mutex_unlock (lock); in omp_unset_lock()
71 omp_test_lock (omp_lock_t *lock) in omp_test_lock() argument
73 return pthread_mutex_trylock (lock) == 0; in omp_test_lock()
[all …]
/openbsd-src/gnu/usr.bin/perl/dist/threads-shared/t/
H A Dcond.t44 my $lock : shared;
47 # test that a subthread can't lock until parent thread has unlocked
50 lock($lock);
51 ok(1, 1, "set first lock");
53 lock($lock);
54 ok(3, 1, "set lock in subthread");
57 ok(2, 1, "still got lock");
66 my $lockref = \$lock;
67 lock($lockref);
70 lock($lockref);
[all …]
H A Dwait.t72 "simple", # cond var == lock var; implicit lock; e.g.: cond_wait($c)
73 "repeat", # cond var == lock var; explicit lock; e.g.: cond_wait($c, $c)
74 "twain" # cond var != lock var; explicit lock; e.g.: cond_wait($c, $l)
82 my $lock :shared;
90 ok($testno++, 1, "$test_type: child before lock");
91 $test_type =~ /twain/ ? lock($lock) : lock($cond);
92 ok($testno++, 1, "$test_type: child obtained lock");
95 no warnings 'threads'; # lock var != cond var, so disable warnings
111 # Which lock to obtain?
112 $test_type =~ /twain/ ? lock($lock) : lock($cond);
[all …]
/openbsd-src/sys/sys/
H A Dwitness.h44 #define LO_CLASSINDEX(lock) \ argument
45 ((((lock)->lo_flags) & LO_CLASSMASK) >> LO_CLASSSHIFT)
46 #define LOCK_CLASS(lock) \ argument
47 (lock_classes[LO_CLASSINDEX((lock))])
102 #define WITNESS_INIT(lock, type) \ argument
103 witness_init((lock), (type))
105 #define WITNESS_CHECKORDER(lock, flags, interlock) \ argument
106 witness_checkorder((lock), (flags), (interlock))
112 #define WITNESS_LOCK(lock, flags) \ argument
113 witness_lock((lock), (flags))
[all …]
/openbsd-src/gnu/gcc/libgomp/config/linux/
H A Dlock.c43 omp_init_lock (omp_lock_t *lock) in omp_init_lock() argument
45 gomp_mutex_init (lock); in omp_init_lock()
49 omp_destroy_lock (omp_lock_t *lock) in omp_destroy_lock() argument
51 gomp_mutex_destroy (lock); in omp_destroy_lock()
55 omp_set_lock (omp_lock_t *lock) in omp_set_lock() argument
57 gomp_mutex_lock (lock); in omp_set_lock()
61 omp_unset_lock (omp_lock_t *lock) in omp_unset_lock() argument
63 gomp_mutex_unlock (lock); in omp_unset_lock()
67 omp_test_lock (omp_lock_t *lock) in omp_test_lock() argument
69 return __sync_bool_compare_and_swap (lock, 0, 1); in omp_test_lock()
[all …]
/openbsd-src/gnu/gcc/libgomp/
H A Dfortran.c66 omp_init_lock_ (omp_lock_arg_t lock) in ialias_redirect()
69 omp_lock_arg (lock) = malloc (sizeof (omp_lock_t)); in ialias_redirect()
71 omp_init_lock (omp_lock_arg (lock)); in ialias_redirect()
75 omp_init_nest_lock_ (omp_nest_lock_arg_t lock) in omp_init_nest_lock_() argument
78 omp_nest_lock_arg (lock) = malloc (sizeof (omp_nest_lock_t)); in omp_init_nest_lock_()
80 omp_init_nest_lock (omp_nest_lock_arg (lock)); in omp_init_nest_lock_()
84 omp_destroy_lock_ (omp_lock_arg_t lock) in omp_destroy_lock_() argument
86 omp_destroy_lock (omp_lock_arg (lock)); in omp_destroy_lock_()
88 free (omp_lock_arg (lock)); in omp_destroy_lock_()
89 omp_lock_arg (lock) = NULL; in omp_destroy_lock_()
[all …]
/openbsd-src/sbin/unwind/libunbound/util/storage/
H A Dlruhash.c55 lock_quick_init(&array[i].lock); in bin_init()
56 lock_protect(&array[i].lock, &array[i], in bin_init()
71 lock_quick_init(&table->lock); in lruhash_create()
87 lock_quick_destroy(&table->lock); in lruhash_create()
92 lock_protect(&table->lock, table, sizeof(*table)); in lruhash_create()
93 lock_protect(&table->lock, table->array, in lruhash_create()
105 lock_quick_destroy(&bin->lock); in bin_delete()
134 lock_quick_lock(&table->array[i].lock); in bin_split()
137 lock_quick_lock(&newa[i].lock); in bin_split()
138 lock_quick_lock(&newa[newbit|i].lock); in bin_split()
[all …]
/openbsd-src/usr.sbin/unbound/util/storage/
H A Dlruhash.c55 lock_quick_init(&array[i].lock); in bin_init()
56 lock_protect(&array[i].lock, &array[i], in bin_init()
71 lock_quick_init(&table->lock); in lruhash_create()
87 lock_quick_destroy(&table->lock); in lruhash_create()
92 lock_protect(&table->lock, table, sizeof(*table)); in lruhash_create()
93 lock_protect(&table->lock, table->array, in lruhash_create()
105 lock_quick_destroy(&bin->lock); in bin_delete()
134 lock_quick_lock(&table->array[i].lock); in bin_split()
137 lock_quick_lock(&newa[i].lock); in bin_split()
138 lock_quick_lock(&newa[newbit|i].lock); in bin_split()
[all …]
/openbsd-src/gnu/llvm/compiler-rt/lib/sanitizer_common/
H A Dsanitizer_atomic_clang_mips.h23 static void __spin_lock(volatile int *lock) { in __spin_lock() argument
24 while (__sync_lock_test_and_set(lock, 1)) in __spin_lock()
25 while (*lock) { in __spin_lock()
29 static void __spin_unlock(volatile int *lock) { __sync_lock_release(lock); } in __spin_unlock() argument
35 int lock; member
37 } __attribute__((aligned(32))) lock = {0, {0}}; variable
49 __spin_lock(&lock.lock); in atomic_fetch_add()
52 __spin_unlock(&lock.lock); in atomic_fetch_add()
78 __spin_lock(&lock.lock); in atomic_compare_exchange_strong()
84 __spin_unlock(&lock.lock); in atomic_compare_exchange_strong()
[all …]
/openbsd-src/gnu/usr.bin/cvs/src/
H A Dlock.c78 struct lock { struct
95 static int set_lock PROTO ((struct lock *lock, int will_wait)); argument
96 static void clear_lock PROTO ((struct lock *lock));
100 static int write_lock PROTO ((struct lock *lock));
101 static void lock_simple_remove PROTO ((struct lock *lock));
125 static struct lock global_readlock;
341 lock_simple_remove ((struct lock *)p->data);
347 lock_simple_remove (lock) in lock_simple_remove() argument
348 struct lock *lock; in lock_simple_remove()
358 tmp = lock_name (lock->repository, readlock);
[all …]
/openbsd-src/lib/libc/thread/
H A Drthread_sync.c46 mutex->lock = _SPINLOCK_UNLOCKED; in pthread_mutex_init()
109 _spinlock(&mutex->lock); in _rthread_mutex_lock()
121 _spinunlock(&mutex->lock); in _rthread_mutex_lock()
132 &mutex->lock, NULL) != EWOULDBLOCK) in _rthread_mutex_lock()
133 _spinlock(&mutex->lock); in _rthread_mutex_lock()
137 _spinunlock(&mutex->lock); in _rthread_mutex_lock()
142 _spinunlock(&mutex->lock); in _rthread_mutex_lock()
149 &mutex->lock, NULL); in _rthread_mutex_lock()
150 _spinlock(&mutex->lock); in _rthread_mutex_lock()
156 _spinunlock(&mutex->lock); in _rthread_mutex_lock()
[all …]
/openbsd-src/sbin/unwind/libunbound/services/
H A Dview.c64 lock_rw_init(&v->lock); in views_create()
65 lock_protect(&v->lock, &v->vtree, sizeof(v->vtree)); in views_create()
79 lock_rw_destroy(&v->lock); in view_delete()
98 lock_rw_destroy(&v->lock); in views_delete()
115 lock_rw_init(&v->lock); in view_create()
116 lock_protect(&v->lock, &v->name, sizeof(*v)-sizeof(rbnode_type)); in view_create()
131 lock_rw_wrlock(&vs->lock); in views_enter_view_name()
132 lock_rw_wrlock(&v->lock); in views_enter_view_name()
135 lock_rw_unlock(&v->lock); in views_enter_view_name()
137 lock_rw_unlock(&vs->lock); in views_enter_view_name()
[all …]

12345678910>>...41