source: branches/io/libtransmission/platform.h @ 1204

Last change on this file since 1204 was 1204, checked in by titer, 15 years ago

Typo, cleaning

  • Property svn:keywords set to Date Rev Author Id
File size: 2.3 KB
Line 
1/******************************************************************************
2 * $Id: platform.h 1204 2006-12-14 03:52:47Z titer $
3 *
4 * Copyright (c) 2005 Transmission authors and contributors
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *****************************************************************************/
24#ifndef TR_PLATFORM_H
25#define TR_PLATFORM_H 1
26
27#ifdef SYS_BEOS
28  #include <kernel/OS.h>
29  typedef thread_id tr_thread_t;
30  typedef sem_id    tr_lock_t;
31  typedef int       tr_cond_t;
32#else
33  #include <pthread.h>
34  typedef pthread_t       tr_thread_t;
35  typedef pthread_mutex_t tr_lock_t;
36  typedef pthread_cond_t  tr_cond_t;
37#endif
38
39char * tr_getCacheDirectory();
40char * tr_getTorrentsDirectory();
41
42void tr_threadCreate ( tr_thread_t *, void (*func)(void *), void * arg );
43void tr_threadJoin   ( tr_thread_t * );
44void tr_lockInit     ( tr_lock_t * );
45void tr_lockClose    ( tr_lock_t * );
46
47static inline void tr_lockLock( tr_lock_t * l )
48{
49#ifdef SYS_BEOS
50    acquire_sem( *l );
51#else
52    pthread_mutex_lock( l );
53#endif
54}
55
56static inline void tr_lockUnlock( tr_lock_t * l )
57{
58#ifdef SYS_BEOS
59    release_sem( *l );
60#else
61    pthread_mutex_unlock( l );
62#endif
63}
64
65void tr_condInit( tr_cond_t * );
66void tr_condWait( tr_cond_t *, tr_lock_t * );
67void tr_condSignal( tr_cond_t * );
68void tr_condClose( tr_cond_t * );
69
70int
71tr_getDefaultRoute( struct in_addr * addr );
72
73#endif
Note: See TracBrowser for help on using the repository browser.