Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nix
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5a01ff6b4760
Choose a base ref
...
head repository: NixOS/nix
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c67476fb7ad3
Choose a head ref
  • 2 commits
  • 4 files changed
  • 2 contributors

Commits on Apr 19, 2018

  1. Wrap thread local in function for Cygwin

    Fixes #1826. See #1352 for a previous instance of a similar change.
    
    (cherry picked from commit be54f4a)
    masaeedu authored and edolstra committed Apr 19, 2018
    Copy the full SHA
    e30bd35 View commit details
  2. Bump version to 2.0.1

    edolstra committed Apr 19, 2018
    Copy the full SHA
    c67476f View commit details
Showing with 18 additions and 8 deletions.
  1. +1 −1 src/libstore/download.hh
  2. +10 −1 src/libutil/logging.cc
  3. +6 −5 src/libutil/logging.hh
  4. +1 −1 version
2 changes: 1 addition & 1 deletion src/libstore/download.hh
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ struct DownloadRequest
std::string mimeType;

DownloadRequest(const std::string & uri)
: uri(uri), parentAct(curActivity) { }
: uri(uri), parentAct(getCurActivity()) { }
};

struct DownloadResult
11 changes: 10 additions & 1 deletion src/libutil/logging.cc
Original file line number Diff line number Diff line change
@@ -6,7 +6,16 @@

namespace nix {

thread_local ActivityId curActivity = 0;
static thread_local ActivityId curActivity = 0;

ActivityId getCurActivity()
{
return curActivity;
}
void setCurActivity(const ActivityId activityId)
{
curActivity = activityId;
}

Logger * logger = makeDefaultLogger();

11 changes: 6 additions & 5 deletions src/libutil/logging.hh
Original file line number Diff line number Diff line change
@@ -77,7 +77,8 @@ public:
virtual void result(ActivityId act, ResultType type, const Fields & fields) { };
};

extern thread_local ActivityId curActivity;
ActivityId getCurActivity();
void setCurActivity(const ActivityId activityId);

struct Activity
{
@@ -86,10 +87,10 @@ struct Activity
const ActivityId id;

Activity(Logger & logger, Verbosity lvl, ActivityType type, const std::string & s = "",
const Logger::Fields & fields = {}, ActivityId parent = curActivity);
const Logger::Fields & fields = {}, ActivityId parent = getCurActivity());

Activity(Logger & logger, ActivityType type,
const Logger::Fields & fields = {}, ActivityId parent = curActivity)
const Logger::Fields & fields = {}, ActivityId parent = getCurActivity())
: Activity(logger, lvlError, type, "", fields, parent) { };

Activity(const Activity & act) = delete;
@@ -122,8 +123,8 @@ struct Activity
struct PushActivity
{
const ActivityId prevAct;
PushActivity(ActivityId act) : prevAct(curActivity) { curActivity = act; }
~PushActivity() { curActivity = prevAct; }
PushActivity(ActivityId act) : prevAct(getCurActivity()) { setCurActivity(act); }
~PushActivity() { setCurActivity(prevAct); }
};

extern Logger * logger;
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0
2.0.1