mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Code Cleanup
- Thread object removed - not needed.
This commit is contained in:
parent
683a269991
commit
8bc7d5932b
3 changed files with 9 additions and 156 deletions
|
@ -12,15 +12,15 @@ set (task_SRCS API.cpp API.h Att.cpp Att.h Cmd.cpp Cmd.h Color.cpp Color.h
|
||||||
Nibbler.cpp Nibbler.h Path.cpp Path.h Permission.cpp Permission.h
|
Nibbler.cpp Nibbler.h Path.cpp Path.h Permission.cpp Permission.h
|
||||||
Record.cpp Record.h Rectangle.cpp Rectangle.h Sequence.cpp
|
Record.cpp Record.h Rectangle.cpp Rectangle.h Sequence.cpp
|
||||||
Sequence.h Subst.cpp Subst.h TDB.cpp TDB.h Table.cpp TDB2.cpp
|
Sequence.h Subst.cpp Subst.h TDB.cpp TDB.h Table.cpp TDB2.cpp
|
||||||
TDB2.h Table.h Task.cpp Task.h Taskmod.cpp Taskmod.h Thread.cpp
|
TDB2.h Table.h Task.cpp Task.h Taskmod.cpp Taskmod.h Timer.cpp
|
||||||
Thread.h Timer.cpp Timer.h Transport.cpp Transport.h
|
Timer.h Transport.cpp Transport.h TransportSSH.cpp TransportSSH.h
|
||||||
TransportSSH.cpp TransportSSH.h TransportRSYNC.cpp
|
TransportRSYNC.cpp TransportRSYNC.h TransportCurl.cpp
|
||||||
TransportRSYNC.h TransportCurl.cpp TransportCurl.h Tree.cpp
|
TransportCurl.h Tree.cpp Tree.h burndown.cpp command.cpp
|
||||||
Tree.h burndown.cpp command.cpp custom.cpp dependency.cpp
|
custom.cpp dependency.cpp diag.cpp edit.cpp export.cpp
|
||||||
diag.cpp edit.cpp export.cpp history.cpp i18n.h import.cpp
|
history.cpp i18n.h import.cpp interactive.cpp recur.cpp
|
||||||
interactive.cpp recur.cpp report.cpp rules.cpp rx.cpp rx.h
|
report.cpp rules.cpp rx.cpp rx.h text.cpp text.h utf8.cpp utf8.h
|
||||||
text.cpp text.h utf8.cpp utf8.h util.cpp util.h Uri.cpp Uri.h
|
util.cpp util.h Uri.cpp Uri.h Variant.cpp Variant.h View.cpp
|
||||||
Variant.cpp Variant.h View.cpp View.h)
|
View.h)
|
||||||
|
|
||||||
add_library (task STATIC ${task_SRCS})
|
add_library (task STATIC ${task_SRCS})
|
||||||
add_executable (task_executable main.cpp)
|
add_executable (task_executable main.cpp)
|
||||||
|
|
|
@ -1,89 +0,0 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// taskwarrior - a command line task list manager.
|
|
||||||
//
|
|
||||||
// Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez.
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU General Public License as published by the Free Software
|
|
||||||
// Foundation; either version 2 of the License, or (at your option) any later
|
|
||||||
// version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
||||||
// details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License along with
|
|
||||||
// this program; if not, write to the
|
|
||||||
//
|
|
||||||
// Free Software Foundation, Inc.,
|
|
||||||
// 51 Franklin Street, Fifth Floor,
|
|
||||||
// Boston, MA
|
|
||||||
// 02110-1301
|
|
||||||
// USA
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
#include <iostream>
|
|
||||||
#include <Thread.h>
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
Thread::Thread ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
Thread::~Thread ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
int Thread::start (void* inArg)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_LIBPTHREAD
|
|
||||||
mArg = inArg;
|
|
||||||
return pthread_create (&mTID, NULL, (void*(*)(void*)) Thread::entryPoint, (void*) this);
|
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
void Thread::wait ()
|
|
||||||
{
|
|
||||||
#ifdef HAVE_LIBPTHREAD
|
|
||||||
pthread_join (mTID, NULL);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
void Thread::cancel ()
|
|
||||||
{
|
|
||||||
#ifdef HAVE_LIBPTHREAD
|
|
||||||
pthread_cancel (mTID);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
void Thread::detach ()
|
|
||||||
{
|
|
||||||
#ifdef HAVE_LIBPTHREAD
|
|
||||||
pthread_detach (mTID);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
void* Thread::entryPoint (void* inThis)
|
|
||||||
{
|
|
||||||
Thread* p = (Thread*) inThis;
|
|
||||||
p->execute (p->arg ());
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
void* Thread::arg ()
|
|
||||||
{
|
|
||||||
return mArg;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
58
src/Thread.h
58
src/Thread.h
|
@ -1,58 +0,0 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// taskwarrior - a command line task list manager.
|
|
||||||
//
|
|
||||||
// Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez.
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU General Public License as published by the Free Software
|
|
||||||
// Foundation; either version 2 of the License, or (at your option) any later
|
|
||||||
// version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
||||||
// details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License along with
|
|
||||||
// this program; if not, write to the
|
|
||||||
//
|
|
||||||
// Free Software Foundation, Inc.,
|
|
||||||
// 51 Franklin Street, Fifth Floor,
|
|
||||||
// Boston, MA
|
|
||||||
// 02110-1301
|
|
||||||
// USA
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
#ifndef INCLUDED_THREAD
|
|
||||||
#define INCLUDED_THREAD
|
|
||||||
|
|
||||||
#include <../cmake.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_LIBPTHREAD
|
|
||||||
#include <pthread.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class Thread
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Thread ();
|
|
||||||
virtual ~Thread ();
|
|
||||||
int start (void* arg);
|
|
||||||
void wait ();
|
|
||||||
void cancel ();
|
|
||||||
void detach ();
|
|
||||||
void* arg ();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
static void* entryPoint (void*);
|
|
||||||
virtual void execute (void*) = 0;
|
|
||||||
|
|
||||||
private:
|
|
||||||
pthread_t mTID;
|
|
||||||
void* mArg;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
Loading…
Add table
Add a link
Reference in a new issue