mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 01:44:06 -04:00
more debugging?
This commit is contained in:
parent
98aee03ca0
commit
071cf37368
@ -527,8 +527,8 @@ paint_progress_bar(CGContextRef context) {
|
|||||||
CGPoint end_point = CGContextGetTextPosition(context);
|
CGPoint end_point = CGContextGetTextPosition(context);
|
||||||
float text_width = end_point.x;
|
float text_width = end_point.x;
|
||||||
|
|
||||||
int text_x = (_win_width - text_width) / 2;
|
int text_x = (int)(_win_width - text_width) / 2;
|
||||||
int text_y = bar_y - text_height * 1.5;
|
int text_y = (int)(bar_y - text_height * 1.5);
|
||||||
|
|
||||||
// Clear the rectangle behind the text to white.
|
// Clear the rectangle behind the text to white.
|
||||||
CGRect text_rect = { { text_x - 2, text_y - 2 }, { text_width + 4, text_height + 4 } };
|
CGRect text_rect = { { text_x - 2, text_y - 2 }, { text_width + 4, text_height + 4 } };
|
||||||
|
@ -1128,7 +1128,7 @@ set_failed() {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void P3DSession::
|
void P3DSession::
|
||||||
spawn_read_thread() {
|
spawn_read_thread() {
|
||||||
assert(!_read_thread_continue);
|
assert(!_started_read_thread && !_read_thread_continue);
|
||||||
|
|
||||||
_read_thread_continue = true;
|
_read_thread_continue = true;
|
||||||
SPAWN_THREAD(_read_thread, rt_thread_run, this);
|
SPAWN_THREAD(_read_thread, rt_thread_run, this);
|
||||||
|
@ -49,10 +49,12 @@ public:
|
|||||||
#define SPAWN_THREAD(thread, callback_function, this) \
|
#define SPAWN_THREAD(thread, callback_function, this) \
|
||||||
(thread) = CreateThread(NULL, 0, &win_ ## callback_function, (this), 0, NULL)
|
(thread) = CreateThread(NULL, 0, &win_ ## callback_function, (this), 0, NULL)
|
||||||
#define JOIN_THREAD(thread) \
|
#define JOIN_THREAD(thread) \
|
||||||
|
{ \
|
||||||
assert((thread) != NULL); \
|
assert((thread) != NULL); \
|
||||||
WaitForSingleObject((thread), INFINITE); \
|
WaitForSingleObject((thread), INFINITE); \
|
||||||
CloseHandle((thread)); \
|
CloseHandle((thread)); \
|
||||||
(thread) = NULL;
|
(thread) = NULL; \
|
||||||
|
}
|
||||||
|
|
||||||
// Declare this macro within your class declaration. This implements
|
// Declare this macro within your class declaration. This implements
|
||||||
// the callback function wrapper necessary to hook into the above
|
// the callback function wrapper necessary to hook into the above
|
||||||
@ -89,17 +91,26 @@ public:
|
|||||||
#define THREAD pthread_t
|
#define THREAD pthread_t
|
||||||
#define INIT_THREAD(thread) (thread) = 0;
|
#define INIT_THREAD(thread) (thread) = 0;
|
||||||
#define SPAWN_THREAD(thread, callback_function, this) \
|
#define SPAWN_THREAD(thread, callback_function, this) \
|
||||||
|
{ \
|
||||||
pthread_attr_t attr; \
|
pthread_attr_t attr; \
|
||||||
pthread_attr_init(&attr); \
|
pthread_attr_init(&attr); \
|
||||||
pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); \
|
pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); \
|
||||||
pthread_create(&(thread), &attr, &posix_ ## callback_function, (void *)(this)); \
|
pthread_create(&(thread), &attr, &posix_ ## callback_function, (void *)(this)); \
|
||||||
pthread_attr_destroy(&attr);
|
pthread_attr_destroy(&attr); \
|
||||||
|
}
|
||||||
|
|
||||||
#define JOIN_THREAD(thread) \
|
#define JOIN_THREAD(thread) \
|
||||||
|
{ \
|
||||||
assert((thread) != 0); \
|
assert((thread) != 0); \
|
||||||
void *return_val; \
|
void *return_val; \
|
||||||
pthread_join((thread), &return_val); \
|
int success = pthread_join((thread), &return_val); \
|
||||||
(thread) = 0;
|
(thread) = 0; \
|
||||||
|
if (success != 0) { \
|
||||||
|
nout << "Failed to join: " << success << "\n"; \
|
||||||
|
} else { \
|
||||||
|
nout << "Successfully joined thread: " << return_val << "\n"; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
// As above, declare this macro within your class declaration.
|
// As above, declare this macro within your class declaration.
|
||||||
#define THREAD_CALLBACK_DECLARATION(class, callback_function) \
|
#define THREAD_CALLBACK_DECLARATION(class, callback_function) \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user