Skip to content

Commit

Permalink
Add issue number to MARL_DEPRECATED()
Browse files Browse the repository at this point in the history
So that we can link to the relevant information about the deprecated APIs.

Issue: #139
  • Loading branch information
ben-clayton committed Jun 4, 2020
1 parent 1f010ca commit fcbe1f2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
12 changes: 9 additions & 3 deletions include/marl/deprecated.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,18 @@

#if MARL_WARN_DEPRECATED
#if defined(_WIN32)
#define MARL_DEPRECATED(message) __declspec(deprecated(message))
#define MARL_DEPRECATED(issue_num, message) \
__declspec(deprecated( \
message "\nSee: https://github.com/google/marl/issues/" #issue_num \
" for more information"))
#else
#define MARL_DEPRECATED(message) __attribute__((deprecated(message)))
#define MARL_DEPRECATED(issue_num, message) \
__attribute__((deprecated( \
message "\nSee: https://github.com/google/marl/issues/" #issue_num \
" for more information")))
#endif
#else
#define MARL_DEPRECATED(message)
#define MARL_DEPRECATED(issue_num, message)
#endif

#endif // marl_deprecated_h
10 changes: 5 additions & 5 deletions include/marl/scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,30 +103,30 @@ class Scheduler {
const Config& config() const;

#if MARL_ENABLE_DEPRECATED_SCHEDULER_GETTERS_SETTERS
MARL_DEPRECATED("use Scheduler::Scheduler(const Config&)")
MARL_DEPRECATED(139, "use Scheduler::Scheduler(const Config&)")
Scheduler(Allocator* allocator = Allocator::Default);

// setThreadInitializer() sets the worker thread initializer function which
// will be called for each new worker thread spawned.
// The initializer will only be called on newly created threads (call
// setThreadInitializer() before setWorkerThreadCount()).
MARL_DEPRECATED("use Config::setWorkerThreadInitializer()")
MARL_DEPRECATED(139, "use Config::setWorkerThreadInitializer()")
void setThreadInitializer(const std::function<void()>& init);

// getThreadInitializer() returns the thread initializer function set by
// setThreadInitializer().
MARL_DEPRECATED("use config().workerThread.initializer")
MARL_DEPRECATED(139, "use config().workerThread.initializer")
std::function<void()> getThreadInitializer();

// setWorkerThreadCount() adjusts the number of dedicated worker threads.
// A count of 0 puts the scheduler into single-threaded mode.
// Note: Currently the number of threads cannot be adjusted once tasks
// have been enqueued. This restriction may be lifted at a later time.
MARL_DEPRECATED("use Config::setWorkerThreadCount()")
MARL_DEPRECATED(139, "use Config::setWorkerThreadCount()")
void setWorkerThreadCount(int count);

// getWorkerThreadCount() returns the number of worker threads.
MARL_DEPRECATED("use config().workerThread.count")
MARL_DEPRECATED(139, "use config().workerThread.count")
int getWorkerThreadCount();
#endif // MARL_ENABLE_DEPRECATED_SCHEDULER_GETTERS_SETTERS

Expand Down

0 comments on commit fcbe1f2

Please sign in to comment.