Skip to content

Commit

Permalink
comment fix and shift_column_locker code organization
Browse files Browse the repository at this point in the history
  • Loading branch information
rishithaminol committed Mar 21, 2018
1 parent 66cde10 commit 9256e9a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 0 additions & 3 deletions cmarketcap.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
#include "timer.h"

pthread_mutex_t shift_column_locker = PTHREAD_MUTEX_INITIALIZER;
#define LOCK_SHIFT_COLUMN_LOCKER pthread_mutex_lock(&shift_column_locker)
#define UNLOCK_SHIFT_COLUMN_LOCKER pthread_mutex_unlock(&shift_column_locker)

struct global_data_handle global_data_handle;

/* @brief coin_history column map */
Expand Down
8 changes: 8 additions & 0 deletions cmarketcap.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,12 @@ extern char *prog_name;
extern pthread_mutex_t shift_column_locker;
extern struct global_data_handle global_data_handle;

/*!
This locks others while 'cmarketcap.c' shift columns using
shift_columns(). This segment solve synchronization
problems between section 'cmarketcap.c' and 'httpd.c'
*/
#define LOCK_SHIFT_COLUMN_LOCKER pthread_mutex_lock(&shift_column_locker)
#define UNLOCK_SHIFT_COLUMN_LOCKER pthread_mutex_unlock(&shift_column_locker)

#endif
4 changes: 0 additions & 4 deletions httpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
#define CLIENT_MAX 10
#define MAX_URI_SIZE 2048

/**! this locks others while shift_columns in action. */
#define LOCK_SHIFT_COLUMN_LOCKER pthread_mutex_lock(&shift_column_locker)
#define UNLOCK_SHIFT_COLUMN_LOCKER pthread_mutex_unlock(&shift_column_locker)

static void parse_http_header(char *buff, struct myhttp_header *header);
static void *__cb_read_from_client(void *cb_arg);
static int check_http_header(struct myhttp_header *header);
Expand Down

0 comments on commit 9256e9a

Please sign in to comment.