Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F619733
thread.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
877 B
Referenced Files
None
Subscribers
None
thread.h
View Options
#ifndef _paintown_thread_h
#define _paintown_thread_h
#include
<pthread.h>
namespace
Util
{
class
Thread
{
public
:
/* does not start a new thread yet */
Thread
();
/* starts a thread */
Thread
(
void
*
(
*
thread
)(
void
*
),
void
*
arg
);
/* starts a thread */
void
start
(
void
*
(
*
thread
)(
void
*
),
void
*
arg
);
bool
isRunning
();
void
kill
();
virtual
~
Thread
();
public
:
/* actually runs the thread */
void
doRun
();
protected
:
pthread_mutex_t
doneLock
;
pthread_t
thread
;
volatile
bool
done
;
void
*
arg
;
void
*
(
*
function
)(
void
*
);
};
/* wraps a boolean with lock/unlock while checking/setting it */
class
ThreadBoolean
{
public
:
ThreadBoolean
(
volatile
bool
&
what
,
pthread_mutex_t
&
lock
);
bool
get
();
void
set
(
bool
value
);
protected
:
volatile
bool
&
what
;
pthread_mutex_t
&
lock
;
};
}
#endif
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Sat, Nov 14, 5:08 PM (11 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
137268
Default Alt Text
thread.h (877 B)
Attached To
Mode
R75 R-Tech1
Attached
Detach File
Event Timeline