File: container-thread-safe.lisp

package info (click to toggle)
cl-containers 20170403-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,072 kB
  • ctags: 1,387
  • sloc: lisp: 8,341; makefile: 14
file content (33 lines) | stat: -rw-r--r-- 948 bytes parent folder | download | duplicates (4)
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
(in-package #:containers)

(defclass* thread-safe-container-mixin ()
  ()
  (:export-p t))

(defmethod insert-item :around ((container thread-safe-container-mixin) item)
  (declare (ignore item))
  (u:with-write-access (:container)
    (call-next-method)))

(defmethod delete-first :around ((container thread-safe-container-mixin))
  (u:with-write-access (:container)
    (call-next-method)))

(defmethod iterate-nodes :around ((container thread-safe-container-mixin) fn)
  (declare (ignore fn))
  (u:with-read-access (:container)
    (call-next-method)))

(defmethod empty! :around ((container thread-safe-container-mixin))
  (u:with-write-access (:container)
    (call-next-method)))

(defmethod first-item :around ((container thread-safe-container-mixin))
  (u:with-read-access (:container)
    (call-next-method)))

(defmethod size :around ((container thread-safe-container-mixin))
  (u:with-read-access (:container)
    (call-next-method)))