Skip to content

Commit

Permalink
wrap of int
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Jan 11, 2017
1 parent 547c48d commit a05865b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const int LOOP_SIZE = 10000;

#define THREAD_NUM 1

#define DATA_TYPE int

void *customer(void *arg)
{
Ring_Queue queue = *(Ring_Queue *)arg;
Expand All @@ -26,7 +28,7 @@ void *customer(void *arg)
for(int i = 0;i < LOOP_SIZE; )
{
int *p = 0;
p = (int *)queue.SOLO_Read();
p = (DATA_TYPE *)queue.SOLO_Read();
if (p)
{
assert(i == *p);
Expand All @@ -51,7 +53,7 @@ void *producer(void *arg)
for(int i = 0;i < LOOP_SIZE; )
{
int *p = 0;
p = (int *)queue.SOLO_Write();
p = (DATA_TYPE *)queue.SOLO_Write();
if (p)
{
*p = i;
Expand All @@ -74,7 +76,7 @@ int main(int argc,char *argv[])
{
pthread_t tid_customer[THREAD_NUM];
pthread_t tid_producer[THREAD_NUM];
Ring_Queue *queue = new Ring_Queue[THREAD_NUM](LOOP_SIZE,4);
Ring_Queue *queue = new Ring_Queue[THREAD_NUM](LOOP_SIZE,sizeof(DATA_TYPE));

for (int i = 0; i < THREAD_NUM; i++)
{
Expand Down

0 comments on commit a05865b

Please sign in to comment.