- void write(float *vec) {
- if (size - cpos < bufsize_type(cvlen)) flushToTempFile();
- memcpy(buffer + cpos, vec, FLOATSIZE * cvlen);
- cpos += cvlen;
- ++to;
+ void write(int n, float **vecs) {
+ pthread_assert(pthread_mutex_lock(&lock), "pthread_mutex_lock", "Error occurred while acquiring the lock!");
+ for (int i = 0; i < n; i++) {
+ if (size - cpos < bufsize_type(cvlen)) flushToTempFile();
+ memcpy(buffer + cpos, vecs[i], FLOATSIZE * cvlen);
+ cpos += cvlen;
+ ++to;
+ }
+ pthread_assert(pthread_mutex_unlock(&lock), "pthread_mutex_unlock", "Error occurred while releasing the lock!");