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 #define TORRENT_BEOS
#include <storage/StorageDefs.h> // B_PATH_NAME_LENGTH #include <storage/StorageDefs.h> // B_PATH_NAME_LENGTH
#define TORRENT_HAS_FALLOCATE 0 #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 #else
#warning unknown OS, assuming BSD #warning unknown OS, assuming BSD
#define TORRENT_BSD #define TORRENT_BSD

View File

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

View File

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