hydra-queue-runner: Set a thread title for the builder threads

This should make debugging slightly easier.
This commit is contained in:
Eelco Dolstra 2017-07-25 15:58:54 +02:00
parent a6d9201947
commit e117d85c2a
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -8,8 +8,18 @@
using namespace nix; using namespace nix;
void setThreadName(const std::string & name)
{
#ifdef __linux__
pthread_setname_np(pthread_self(), std::string(name, 0, 15).c_str());
#endif
}
void State::builder(MachineReservation::ptr reservation) void State::builder(MachineReservation::ptr reservation)
{ {
setThreadName("bld~" + baseNameOf(reservation->step->drvPath));
StepResult res = sRetry; StepResult res = sRetry;
nrStepsStarted++; nrStepsStarted++;