1 | /* |
---|
2 | * This file Copyright (C) 2009-2014 Mnemosyne LLC |
---|
3 | * |
---|
4 | * It may be used under the GNU GPL versions 2 or 3 |
---|
5 | * or any future license endorsed by Mnemosyne LLC. |
---|
6 | * |
---|
7 | * $Id: platform.h 14724 2016-03-29 16:37:21Z mikedld $ |
---|
8 | */ |
---|
9 | |
---|
10 | #ifndef __TRANSMISSION__ |
---|
11 | #error only libtransmission should #include this header. |
---|
12 | #endif |
---|
13 | |
---|
14 | #pragma once |
---|
15 | |
---|
16 | #define TR_PATH_DELIMITER '/' |
---|
17 | #define TR_PATH_DELIMITER_STR "/" |
---|
18 | |
---|
19 | /** |
---|
20 | * @addtogroup tr_session Session |
---|
21 | * @{ |
---|
22 | */ |
---|
23 | |
---|
24 | /** |
---|
25 | * @brief invoked by tr_sessionInit () to set up the locations of the resume, torrent, and clutch directories. |
---|
26 | * @see tr_getResumeDir () |
---|
27 | * @see tr_getTorrentDir () |
---|
28 | * @see tr_getWebClientDir () |
---|
29 | */ |
---|
30 | void tr_setConfigDir (tr_session * session, const char * configDir); |
---|
31 | |
---|
32 | /** @brief return the directory where .resume files are stored */ |
---|
33 | const char * tr_getResumeDir (const tr_session *); |
---|
34 | |
---|
35 | /** @brief return the directory where .torrent files are stored */ |
---|
36 | const char * tr_getTorrentDir (const tr_session *); |
---|
37 | |
---|
38 | /** @brief return the directory where the Web Client's web ui files are kept */ |
---|
39 | const char * tr_getWebClientDir (const tr_session *); |
---|
40 | |
---|
41 | /** @} */ |
---|
42 | |
---|
43 | |
---|
44 | /** |
---|
45 | * @addtogroup utils Utilities |
---|
46 | * @{ |
---|
47 | */ |
---|
48 | |
---|
49 | typedef struct tr_thread tr_thread; |
---|
50 | |
---|
51 | /** @brief Instantiate a new process thread */ |
---|
52 | tr_thread* tr_threadNew (void (*func)(void *), void * arg); |
---|
53 | |
---|
54 | /** @brief Return nonzero if this function is being called from `thread' |
---|
55 | @param thread the thread being tested */ |
---|
56 | bool tr_amInThread (const tr_thread * thread); |
---|
57 | |
---|
58 | /*** |
---|
59 | **** |
---|
60 | ***/ |
---|
61 | |
---|
62 | typedef struct tr_lock tr_lock; |
---|
63 | |
---|
64 | /** @brief Create a new thread mutex object */ |
---|
65 | tr_lock * tr_lockNew (void); |
---|
66 | |
---|
67 | /** @brief Destroy a thread mutex object */ |
---|
68 | void tr_lockFree (tr_lock *); |
---|
69 | |
---|
70 | /** @brief Attempt to lock a thread mutex object */ |
---|
71 | void tr_lockLock (tr_lock *); |
---|
72 | |
---|
73 | /** @brief Unlock a thread mutex object */ |
---|
74 | void tr_lockUnlock (tr_lock *); |
---|
75 | |
---|
76 | /** @brief return nonzero if the specified lock is locked */ |
---|
77 | bool tr_lockHave (const tr_lock *); |
---|
78 | |
---|
79 | /* @} */ |
---|
80 | |
---|