source: trunk/libtransmission/platform.h @ 9868

Last change on this file since 9868 was 9868, checked in by charles, 13 years ago

happy new year!

  • Property svn:keywords set to Date Rev Author Id
File size: 2.3 KB
Line 
1/*
2 * This file Copyright (C) 2009-2010 Mnemosyne LLC
3 *
4 * This file is licensed by the GPL version 2.  Works owned by the
5 * Transmission project are granted a special exemption to clause 2(b)
6 * so that the bulk of its code can remain under the MIT license.
7 * This exemption does not extend to derived works not owned by
8 * the Transmission project.
9 *
10 * $Id: platform.h 9868 2010-01-04 21:00:47Z charles $
11 */
12
13#ifndef TR_PLATFORM_H
14#define TR_PLATFORM_H
15
16#ifndef __TRANSMISSION__
17 #error only libtransmission should #include this header.
18#endif
19
20#if defined( WIN32 )
21 #define TR_PATH_DELIMITER '\\'
22 #define TR_PATH_DELIMITER_STR "\\"
23#else
24 #define TR_PATH_DELIMITER '/'
25 #define TR_PATH_DELIMITER_STR "/"
26#endif
27
28#ifdef WIN32
29 #include <windows.h>
30 #define MAX_PATH_LENGTH  MAX_PATH
31#else
32 #define MAX_PATH_LENGTH  2048
33#endif
34
35#define MAX_STACK_ARRAY_SIZE 7168
36
37/**
38 * @addtogroup utils Utilities
39 * @{
40 */
41
42typedef struct tr_lock   tr_lock;
43typedef struct tr_thread tr_thread;
44
45void                tr_setConfigDir( tr_session * session,
46                                     const char * configDir );
47
48const char *        tr_getResumeDir( const tr_session * );
49
50const char *        tr_getTorrentDir( const tr_session * );
51
52const char *        tr_getClutchDir( const tr_session * );
53
54
55/***
56****
57***/
58
59/** @brief Instantiate a new process thread */
60tr_thread* tr_threadNew( void ( *func )(void *), void * arg );
61
62/** @brief Return nonzero if this function is being called from `thread'
63    @param thread the thread being tested */
64int tr_amInThread( const tr_thread * );
65
66/***
67****
68***/
69
70/** @brief Create a new thread mutex object */
71tr_lock * tr_lockNew( void );
72
73/** @brief Destroy a thread mutex object */
74void tr_lockFree( tr_lock * );
75
76/** @brief Attempt to lock a thread mutex object */
77void tr_lockLock( tr_lock * );
78
79/** @brief Unlock a thread mutex object */
80void tr_lockUnlock( tr_lock * );
81
82/** @brief return nonzero if the specified lock is locked */
83int tr_lockHave( const tr_lock * );
84
85#ifdef WIN32
86void *              mmap( void *ptr,
87                          long  size,
88                          long  prot,
89                          long  type,
90                          long  handle,
91                          long  arg );
92
93long                munmap( void *ptr,
94                            long  size );
95
96#endif
97
98/* @} */
99
100#endif
Note: See TracBrowser for help on using the repository browser.