pthread_mutex_t qlock[5] = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t qcon开发者_JS百科d[5] = PTHREAD_COND_INITIALIZER;
It is giving me error as follows...
error: array must be initialized with a brace-enclosed initializer
.. Please, can somebody debug this or tell me a way to solve it...
This initializes a mutex:
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
This initializes an array:
int array[5] = { 0, 1, 2, 3, 4 };
...that should be enough to get you going.
I'd suggest you reading a beginner book on C programming language. See for example a related SO question.
BTW, at this level of C knowledge I would highly recommend you to stay away from multithreaded programming (at least with pthreads).
精彩评论