Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 133f7abf authored by Mike Yu's avatar Mike Yu Committed by Bernie Innocenti
Browse files

Move thread_util to libnetdutils

This change comprises:

[1] Move thread_util.h to libnetdutils to ease the cleanup of the
    include path system/netd/server for libnetd_resolv.

[2] Rename thread_util.h to ThreadUtil.h.

[3] Add the test to ThreadUtilTest.

Bug: 128662167
Test: system/netd/tests/runtests.sh passed
Change-Id: Ia8e9b196fbe41a4bd1edc7592badaacf57165988
parent daa29938
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -83,7 +83,6 @@ cc_library {
        "libbinder_ndk",
        "libstatslog",
    ],
    // TODO: Get rid of these include paths used in DnsProxyListener.
    include_dirs: [
        "system/netd/include",
        "system/netd/server",
+3 −3
Original line number Diff line number Diff line
@@ -42,12 +42,13 @@
#include <netdutils/OperationLimiter.h>
#include <netdutils/ResponseCode.h>
#include <netdutils/Slice.h>
#include <netdutils/ThreadUtil.h>
#include <private/android_filesystem_config.h>  // AID_SYSTEM
#include <resolv.h>
#include <statslog.h>
#include <sysutils/SocketClient.h>

// TODO: Consider moving Stopwatch.h and thread_util.h to libnetdutils.
// TODO: Consider moving Stopwatch.h to libnetdutils.
#include "DnsResolver.h"
#include "NetdClient.h"  // NETID_USE_LOCAL_NAMESERVERS
#include "NetdPermissions.h"
@@ -55,7 +56,6 @@
#include "Stopwatch.h"
#include "netd_resolv/stats.h"  // RCODE_TIMEOUT
#include "resolv_private.h"
#include "thread_util.h"

using aidl::android::net::metrics::INetdEventListener;

@@ -85,7 +85,7 @@ template<typename T>
void tryThreadOrError(SocketClient* cli, T* handler) {
    cli->incRef();

    const int rval = threadLaunch(handler);
    const int rval = netdutils::threadLaunch(handler);
    if (rval == 0) {
        // SocketClient decRef() happens in the handler's run() method.
        return;