Esempio n. 1
0
int
__new_sem_wait (sem_t *sem)
{
  int errval = __sema_timedwait ((sema_t *)sem, NULL);
  if (errval == ETIME)
    errval = ETIMEDOUT;
  if (errval != 0)
    {
      __set_errno (errval);
      return -1;
    }
  return 0;
}
Esempio n. 2
0
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   02111-1307 USA.  */

#include <errno.h>
#include <sysdep.h>
#include <semaphore.h>

#include <pthreadP.h>
#include <inline-syscall.h>
#include <abstime-to-reltime.h>


int
sem_timedwait (sem_t *sem, const struct timespec *abstime)
{
  COPY_TIMESPEC (abstime)
  int errval = __sema_timedwait ((sema_t *)sem, __abstime);
  if (errval == ETIME)
    errval = ETIMEDOUT;
  if (errval != 0)
    {
      __set_errno (errval);
      return -1;
    }
  return 0;
}