nvidia-texture-tools/src/nvthread/Thread.h

43 lines
819 B
C
Raw Normal View History

2011-09-27 17:48:46 +00:00
// This code is in the public domain -- castano@gmail.com
#pragma once
#ifndef NV_THREAD_THREAD_H
#define NV_THREAD_THREAD_H
#include "nvthread.h"
2012-07-20 16:19:03 +00:00
#include "nvcore/Ptr.h" // AutoPtr
2011-09-27 17:48:46 +00:00
namespace nv
{
typedef void ThreadFunc(void * arg);
2011-09-27 18:12:32 +00:00
class NVTHREAD_CLASS Thread
{
NV_FORBID_COPY(Thread);
public:
Thread();
2015-10-29 06:53:08 +00:00
Thread(const char * name);
2011-09-27 18:12:32 +00:00
~Thread();
2011-09-27 17:48:46 +00:00
2015-10-29 06:53:08 +00:00
void setName(const char * name);
2011-09-28 01:45:08 +00:00
void start(ThreadFunc * func, void * arg);
void wait();
2011-09-27 17:48:46 +00:00
2011-09-28 01:45:08 +00:00
bool isRunning() const;
2011-09-27 17:48:46 +00:00
2011-09-28 01:45:08 +00:00
static void spinWait(uint count);
static void yield();
static void sleep(uint ms);
2011-09-27 17:48:46 +00:00
2011-09-28 01:45:08 +00:00
static void wait(Thread * threads, uint count);
2011-09-27 17:48:46 +00:00
2011-09-28 01:45:08 +00:00
struct Private;
AutoPtr<Private> p;
2011-09-27 18:12:32 +00:00
};
2011-09-27 17:48:46 +00:00
} // nv namespace
#endif // NV_THREAD_THREAD_H