/* * * pop_back * */ int buf_pop_back(){ if (!initialised) { //sprawdz, czy zainicjalizowane printf("First initialise!\n"); return -1; } sem_proberen(sem_empty); sem_proberen(sem_mutex); int retval = queue_pop_back(); sem_verhogen(sem_mutex); sem_verhogen(sem_full); return retval; }
//! //! This is the function that ultimately dumps a buffer into a log. //! //! @param[in] line the string buffer to log //! //! @return EUCA_OK on success or EUCA_ERROR on failure //! //! @pre The given line pointer must not be NULL. //! //! @post The given line is written into the log file //! static int log_line(const char *line) { int rc = EUCA_ERROR; FILE *pFh = NULL; if (log_sem) { sem_prolaag(log_sem, FALSE); if ((pFh = get_file(FALSE)) != NULL) { fprintf(pFh, "%s", line); fflush(pFh); release_file(); rc = EUCA_OK; } sem_verhogen(log_sem, FALSE); } else { if ((pFh = get_file(FALSE)) != NULL) { fprintf(pFh, "%s", line); fflush(pFh); release_file(); rc = EUCA_OK; } } return (rc); }
//! //! This is the function that ultimately dumps a buffer into a log. //! //! @param[in] line the string buffer to log //! //! @return EUCA_OK on success or EUCA_ERROR on failure //! static int log_line(const char *line) { int rc = EUCA_ERROR; if (log_sem) sem_prolaag(log_sem, FALSE); FILE *file = get_file(FALSE); if (file != NULL) { fprintf(file, "%s", line); fflush(file); release_file(); rc = EUCA_OK; } if (log_sem) sem_verhogen(log_sem, FALSE); return rc; }
// The semaphore decrement (aka lock release) function used throughout. int sem_v (sem * s) { return sem_verhogen (s, TRUE); }
//! //! The semaphore decrement (aka lock release) function used throughout. //! //! @param[in] pSem a pointer to the semaphore to release //! //! @return the result from sem_verhogen() //! //! @see sem_verhogen() //! int sem_v(sem * pSem) { return (sem_verhogen(pSem, TRUE)); }