From b3a255a62131703d4ef40758f28572d9fd1a0cc1 Mon Sep 17 00:00:00 2001 From: edgrif <edgrif> Date: Fri, 12 Mar 2004 16:00:38 +0000 Subject: [PATCH] Rearrange request struct so data is condvar protected. Pass data via condvar call. --- src/zmapThreads/zmapConn_P.h | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/zmapThreads/zmapConn_P.h b/src/zmapThreads/zmapConn_P.h index 68a99fd0c..09c5dcf3c 100755 --- a/src/zmapThreads/zmapConn_P.h +++ b/src/zmapThreads/zmapConn_P.h @@ -26,9 +26,9 @@ * Description: * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: - * Last edited: Mar 1 14:24 2004 (edgrif) + * Last edited: Mar 11 15:43 2004 (edgrif) * Created: Thu Jul 24 14:36:08 2003 (edgrif) - * CVS info: $Id: zmapConn_P.h,v 1.3 2004-03-03 12:05:45 edgrif Exp $ + * CVS info: $Id: zmapConn_P.h,v 1.4 2004-03-12 16:00:38 edgrif Exp $ *------------------------------------------------------------------- */ #ifndef ZMAP_CONN_PRIV_H @@ -62,6 +62,7 @@ typedef struct pthread_mutex_t mutex ; /* controls access to this struct. */ pthread_cond_t cond ; /* Slave waits on this. */ ZMapThreadRequest state ; /* Contains request to slave. */ + gchar *data ; /* Contains data for request. */ } ZMapRequestStruct, *ZMapRequest ; /* Replies via a simpler mutex. */ @@ -69,8 +70,8 @@ typedef struct { pthread_mutex_t mutex ; /* controls access to this struct. */ ZMapThreadReply state ; /* Contains reply from slave. */ - char *data ; /* May also contain data for some replies. */ - char *error_msg ; /* May contain error message for when + gchar *data ; /* May also contain data for some replies. */ + gchar *error_msg ; /* May contain error message for when thread fails. */ } ZMapReplyStruct, *ZMapReply ; @@ -84,12 +85,12 @@ typedef struct _ZMapConnectionStruct gchar *machine ; int port ; gchar *protocol ; - gchar *sequence ; pthread_t thread_id ; /* These control the communication between the GUI thread and the connection threads, - * they are mutex locked and the request code makes use of the condition variable. */ + * they are mutex locked and the request code makes use of the condition variable to + * communicate with slave threads. */ ZMapRequestStruct request ; /* GUIs request. */ ZMapReplyStruct reply ; /* Slaves reply. */ @@ -102,15 +103,12 @@ void *zmapNewThread(void *thread_args) ; /* Request routines. */ void zmapCondVarCreate(ZMapRequest thread_state) ; -void zmapCondVarSignal(ZMapRequest thread_state, ZMapThreadRequest new_state) ; +void zmapCondVarSignal(ZMapRequest thread_state, ZMapThreadRequest new_state, gchar *data) ; void zmapCondVarWait(ZMapRequest thread_state, ZMapThreadRequest waiting_state) ; ZMapThreadRequest zmapCondVarWaitTimed(ZMapRequest condvar, ZMapThreadRequest waiting_state, - TIMESPEC *timeout, gboolean reset_to_waiting) ; + TIMESPEC *timeout, gboolean reset_to_waiting, gchar **data) ; void zmapCondVarDestroy(ZMapRequest thread_state) ; -char *zmapVarGetRequestString(ZMapThreadRequest signalled_state) ; - - /* Reply routines. */ void zmapVarCreate(ZMapReply thread_state) ; -- GitLab