2 * Copyright (C) ARM Limited 2010-2014. All rights reserved.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
15 #define sem_init(sem, pshared, value) ((*(sem) = CreateSemaphore(NULL, value, LONG_MAX, NULL)) == NULL)
16 #define sem_wait(sem) WaitForSingleObject(*(sem), INFINITE)
17 #define sem_post(sem) ReleaseSemaphore(*(sem), 1, NULL)
18 #define sem_destroy(sem) CloseHandle(*(sem))
20 #include <semaphore.h>
25 Fifo(int singleBufferSize, int totalBufferSize, sem_t* readerSem);
27 int numBytesFilled() const;
30 bool willFill(int additional) const;
32 char* write(int length);
34 char* read(int *const length);
37 int mSingleBufferSize, mWrite, mRead, mReadCommit, mRaggedEnd, mWrapThreshold;
38 sem_t mWaitForSpaceSem;
43 // Intentionally unimplemented
45 Fifo &operator=(const Fifo &);