Program Listing for carb/thread/IThreadUtil.h

↰ Return to documentation for carb/thread/IThreadUtil.h

// Copyright (c) 2020-2021, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once

#include "../Interface.h"


namespace carb
{
namespace thread
{

using RelayFlags = uint64_t;

constexpr RelayFlags fRelayFlagBlocking = 0x8000000000000000ull;

constexpr RelayFlags fRelayFlagForce = 0x4000000000000000ull;

constexpr RelayFlags fRelayAvailableFlagsMask = 0x0000ffffffffffffull;

using RelayTaskFn = void(CARB_ABI*)(RelayFlags flags, void* context);

struct RelayTaskDesc
{
    RelayTaskFn task;

    RelayFlags flags;

    void* context;
};

enum class RelayResult
{
    eSuccess,

    eBadParam,

    eThreadFailure,

    eShutdown,

    eForced,

    eNoMemory,
};

struct IThreadUtil
{
    CARB_PLUGIN_INTERFACE("carb::thread::IThreadUtil", 1, 0)


    RelayResult(CARB_ABI* runRelayTask)(RelayTaskDesc& desc);
};

} // namespace thread
} // namespace carb