1# Copyright 2021 The Pigweed Authors 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); you may not 4# use this file except in compliance with the License. You may obtain a copy of 5# the License at 6# 7# https://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12# License for the specific language governing permissions and limitations under 13# the License. 14 15load( 16 "//pw_build:pigweed.bzl", 17 "pw_cc_test", 18) 19load( 20 "//pw_build:selects.bzl", 21 "TARGET_COMPATIBLE_WITH_HOST_SELECT", 22) 23 24package(default_visibility = ["//visibility:public"]) 25 26licenses(["notice"]) 27 28cc_library( 29 name = "pw_work_queue", 30 srcs = ["work_queue.cc"], 31 hdrs = [ 32 "public/pw_work_queue/work_queue.h", 33 ], 34 includes = ["public"], 35 deps = [ 36 "//pw_containers:inline_queue", 37 "//pw_function", 38 "//pw_metric:metric", 39 "//pw_status", 40 "//pw_sync:interrupt_spin_lock", 41 "//pw_sync:lock_annotations", 42 "//pw_sync:thread_notification", 43 "//pw_thread:thread", 44 ], 45) 46 47cc_library( 48 name = "test_thread_header", 49 hdrs = ["public/pw_work_queue/test_thread.h"], 50 includes = ["public"], 51) 52 53cc_library( 54 name = "work_queue_test", 55 testonly = True, 56 srcs = [ 57 "work_queue_test.cc", 58 ], 59 deps = [ 60 ":pw_work_queue", 61 ":stl_test_thread", 62 "//pw_log", 63 "//pw_unit_test", 64 ], 65) 66 67cc_library( 68 name = "stl_test_thread", 69 srcs = [ 70 "stl_test_thread.cc", 71 ], 72 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), 73 deps = [ 74 ":test_thread_header", 75 "//pw_thread:thread", 76 "//pw_thread_stl:thread", 77 ], 78) 79 80pw_cc_test( 81 name = "stl_work_queue_test", 82 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), 83 deps = [ 84 ":stl_test_thread", 85 ":work_queue_test", 86 ], 87) 88