struct consumer_socket {
/*
* File descriptor. This is just a reference to the consumer data meaning
- * that every access must be locked and check for a possible invalid value.
+ * that every access must be locked and checked for a possible invalid
+ * value.
*/
- int *fd;
+ int *fd_ptr;
/*
* To use this socket (send/recv), this lock MUST be acquired.
/*
* The metadata socket object is handled differently and only created
* locally in this object thus it's the only reference available in the
- * session daemon. For that reason, a static variable for the fd is
- * required and the metadata socket fd points to it.
+ * session daemon. For that reason, a variable for the fd is required and
+ * the metadata socket fd points to it.
*/
int metadata_fd;
struct consumer_socket metadata_sock;
char err_unix_sock_path[PATH_MAX];
char cmd_unix_sock_path[PATH_MAX];
- /* communication lock */
+ /*
+ * This lock has two purposes. It protects any change to the consumer
+ * socket and make sure only one thread uses this object for read/write
+ * operations.
+ */
pthread_mutex_t lock;
};