more beos

This commit is contained in:
Arvid Norberg 2009-12-09 05:19:48 +00:00
parent 13cb43ffc0
commit 31bbfee895
3 changed files with 18 additions and 0 deletions

View File

@ -116,6 +116,13 @@ POSSIBILITY OF SUCH DAMAGE.
#define TORRENT_BEOS
#include <storage/StorageDefs.h> // B_PATH_NAME_LENGTH
#define TORRENT_HAS_FALLOCATE 0
#if __GNUCC__ == 2
# if defined(TORRENT_BUILDING_SHARED)
# define TORRENT_EXPORT __declspec(dllexport)
# elif defined(TORRENT_LINKING_SHARED)
# define TORRENT_EXPORT __declspec(dllimport)
# endif
#endif
#else
#warning unknown OS, assuming BSD
#define TORRENT_BSD

View File

@ -44,15 +44,22 @@ POSSIBILITY OF SUCH DAMAGE.
#include <boost/asio/detail/mutex.hpp>
#include <boost/asio/detail/event.hpp>
#ifdef TORRENT_BEOS
#include <kernel/OS.h>
#endif
namespace libtorrent
{
typedef boost::asio::detail::thread thread;
typedef boost::asio::detail::mutex mutex;
typedef boost::asio::detail::event condition;
inline void sleep(int milliseconds)
{
#if defined TORRENT_WINDOWS || defined TORRENT_CYGWIN
Sleep(milliseconds);
#elif defined TORRENT_BEOS
snooze_until(system_time() + boost::int64_t(milliseconds) * 1000, B_SYSTEM_TIMEBASE);
#else
usleep(milliseconds * 1000);
#endif

View File

@ -35,6 +35,8 @@ POSSIBILITY OF SUCH DAMAGE.
#ifdef TORRENT_WINDOWS
#include <Windows.h>
#elif defined TORRENT_BEOS
#include <kernel/OS.h>
#else
#include <stdlib.h>
#include <unistd.h> // _SC_PAGESIZE
@ -52,6 +54,8 @@ namespace libtorrent
SYSTEM_INFO si;
GetSystemInfo(&si);
s = si.dwPageSize;
#elif defined TORRENT_BEOS
s = B_PAGE_SIZE;
#else
s = sysconf(_SC_PAGESIZE);
#endif