]>
git.proxmox.com Git - ceph.git/blob - ceph/src/msg/QueueStrategy.h
41f28bb9e7105dc27b584d86c6e0ac2f2f76fe17
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2014 CohortFS, LLC
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
16 #ifndef QUEUE_STRATEGY_H
17 #define QUEUE_STRATEGY_H
19 #include <boost/intrusive/list.hpp>
20 #include "DispatchStrategy.h"
21 #include "msg/Messenger.h"
23 namespace bi
= boost::intrusive
;
25 class QueueStrategy
: public DispatchStrategy
{
30 Message::Queue mqueue
;
32 class QSThread
: public Thread
{
34 bi::list_member_hook
<> thread_q
;
37 explicit QSThread(QueueStrategy
*dq
) : thread_q(), dq(dq
), cond() {}
44 typedef bi::list
< QSThread
,
45 bi::member_hook
< QSThread
,
46 bi::list_member_hook
<>,
47 &QSThread::thread_q
> > Queue
;
50 QSThread::Queue disp_threads
;
53 explicit QueueStrategy(int n_threads
);
54 void ds_dispatch(Message
*m
) override
;
55 void shutdown() override
;
56 void start() override
;
58 void entry(QSThread
*thrd
);
59 virtual ~QueueStrategy() {}
61 #endif /* QUEUE_STRATEGY_H */