Converted to new thread API.
This commit is contained in:
parent
c97875d5c8
commit
bd8d314c29
@ -57,7 +57,7 @@ typedef uintptr_t guac_thread_t;
|
||||
|
||||
#endif
|
||||
|
||||
void guac_thread_create(guac_thread_t* thread, void*(*function)(void*), void* data);
|
||||
int guac_thread_create(guac_thread_t* thread, void*(*function)(void*), void* data);
|
||||
void guac_thread_join(guac_thread_t thread);
|
||||
|
||||
#endif
|
||||
|
@ -39,8 +39,8 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <dlfcn.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include "thread.h"
|
||||
#include "log.h"
|
||||
#include "guacio.h"
|
||||
#include "protocol.h"
|
||||
@ -363,21 +363,21 @@ void* __guac_client_input_thread(void* data) {
|
||||
|
||||
int guac_start_client(guac_client* client) {
|
||||
|
||||
pthread_t input_thread, output_thread;
|
||||
guac_thread_t input_thread, output_thread;
|
||||
|
||||
if (pthread_create(&output_thread, NULL, __guac_client_output_thread, (void*) client)) {
|
||||
if (guac_thread_create(&output_thread, __guac_client_output_thread, (void*) client)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pthread_create(&input_thread, NULL, __guac_client_input_thread, (void*) client)) {
|
||||
if (guac_thread_create(&input_thread, __guac_client_input_thread, (void*) client)) {
|
||||
guac_client_stop(client);
|
||||
pthread_join(output_thread, NULL);
|
||||
guac_thread_join(output_thread);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Wait for I/O threads */
|
||||
pthread_join(input_thread, NULL);
|
||||
pthread_join(output_thread, NULL);
|
||||
guac_thread_join(input_thread);
|
||||
guac_thread_join(output_thread);
|
||||
|
||||
/* Done */
|
||||
return 0;
|
||||
|
@ -44,9 +44,9 @@
|
||||
#include <process.h>
|
||||
#endif
|
||||
|
||||
void guac_thread_create(guac_thread_t* thread, void*(*function)(void*), void* data) {
|
||||
int guac_thread_create(guac_thread_t* thread, void*(*function)(void*), void* data) {
|
||||
#ifdef HAVE_LIBPTHREAD
|
||||
pthread_create(thread, NULL, function, data);
|
||||
return pthread_create(thread, NULL, function, data);
|
||||
#elif defined(__MINGW32__)
|
||||
*thread = _beginthreadex(NULL, 0,
|
||||
function, data, 0 /* Create running */, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user