YARP
Yet Another Robot Platform
ConnectThread.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
9
10#include <yarp/os/Network.h>
11
13
14namespace {
15YARP_SERVERSQL_LOG_COMPONENT(CONNECTTHREAD, "yarp.serversql.impl.ConnectThread")
16} // namespace
17
18
19ConnectThread::ConnectThread(std::mutex& mutex) : mutex(mutex)
20{
21}
22
24{
25 do {
26 mutex.lock();
27 if (ct==0) {
28 needed = false;
29 }
30 ct--;
31 mutex.unlock();
32
33 yCTrace(CONNECTTHREAD,
34 " ]]] con %s %s / %d %d",
35 src.c_str(),
36 dest.c_str(),
37 ct,
38 needed);
39 if (!needed) { break; }
40 if (positive) {
42 yCTrace(CONNECTTHREAD,
43 " (((Trying to connect %s and %s)))",
44 src.c_str(),
45 dest.c_str());
47 }
48 } else {
50 yCTrace(CONNECTTHREAD,
51 " (((Trying to disconnect %s and %s)))\n",
52 src.c_str(),
53 dest.c_str());
55 }
56 }
57 } while (true);
58}
static bool connect(const std::string &src, const std::string &dest, const std::string &carrier="", bool quiet=true)
Request that an output port connect to an input port.
Definition: Network.cpp:682
static bool disconnect(const std::string &src, const std::string &dest, bool quiet)
Request that an output port disconnect from an input port.
Definition: Network.cpp:700
static bool isConnected(const std::string &src, const std::string &dest, bool quiet)
Check if a connection exists between two ports.
Definition: Network.cpp:727
void run() override
Main body of the new thread.
#define yCTrace(component,...)
Definition: LogComponent.h:84
#define YARP_SERVERSQL_LOG_COMPONENT(name, name_string)
Definition: LogComponent.h:29