I am working on a producer/consumer problem and need a little help on calling my functions in a posix thread. What would be the correct syntax for calling producer?
Nothing seems to be working for me today. I have had to delete all my curly braces from from my code in order for it to let me post. When I left them in it kept telling me to use code tags, which I was already using.
An explanation of parts of the thread call might help
using namespace std;
#define N 100
typedef int semaphore;
semaphore mutex =1;
semaphore empty = N;
semaphore full = 0;
bool TRUE = TRUE;
pthread_t thread1, thread2, thread3, thread4;
int err1, err2, err3, err4;
void insert_item (int item);
semaphore down (semaphore value);
int up (int &value);
void consume_item(int item);
int main(int argc, char* argv)
err1 = pthread_create(&thread1, NULL, producer() (void*));//trying to call producer here
item = produce_item();
pthread_create(&thread1, NULL, producer() (void*));
&thread = the pthread you want to use?
Produce() = the fuction i am trying to call?
(void*) = some crazy C thing?