Revert 45697:
[reactos.git] / lib / 3rdparty / fullfat / ff_safety.c
1 /*****************************************************************************
2 * FullFAT - High Performance, Thread-Safe Embedded FAT File-System *
3 * Copyright (C) 2009 James Walmsley (james@worm.me.uk) *
4 * *
5 * This program is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 3 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
17 * *
18 * IMPORTANT NOTICE: *
19 * ================= *
20 * Alternative Licensing is available directly from the Copyright holder, *
21 * (James Walmsley). For more information consult LICENSING.TXT to obtain *
22 * a Commercial license. *
23 * *
24 * See RESTRICTIONS.TXT for extra restrictions on the use of FullFAT. *
25 * *
26 * Removing the above notice is illegal and will invalidate this license. *
27 *****************************************************************************
28 * See http://worm.me.uk/fullfat for more information. *
29 * Or http://fullfat.googlecode.com/ for latest releases and the wiki. *
30 *****************************************************************************/
31
32 /**
33 * @file ff_safety.c
34 * @author James Walmsley
35 * @ingroup SAFETY
36 *
37 * @defgroup SAFETY Process Safety for FullFAT
38 * @brief Provides semaphores, and thread-safety for FullFAT.
39 *
40 * This module aims to be as portable as possible. It is necessary to modify
41 * the functions FF_CreateSemaphore, FF_PendSemaphore, FF_ReleaseSemaphore,
42 * and FF_DestroySemaphore, as appropriate for your platform.
43 *
44 * If your application has no OS and is therefore single threaded, simply
45 * have:
46 *
47 * FF_CreateSemaphore() return NULL.
48 *
49 * FF_PendSemaphore() should do nothing.
50 *
51 * FF_ReleaseSemaphore() should do nothing.
52 *
53 * FF_DestroySemaphore() should do nothing.
54 *
55 **/
56
57 #include "ff_safety.h" // Íncludes ff_types.h
58
59 void *FF_CreateSemaphore(void) {
60 // Call your OS's CreateSemaphore function
61 //
62
63 // return pointer to semaphore
64 return NULL; // Comment this out for your implementation.
65 }
66
67 void FF_PendSemaphore(void *pSemaphore) {
68 // Call your OS's PendSemaphore with the provided pSemaphore pointer.
69 //
70 // This should block indefinitely until the Semaphore
71 // becomes available. (No timeout!)
72 // If your OS doesn't do it for you, you should sleep
73 // this thread until the Semaphore is available.
74 pSemaphore = 0;
75 }
76
77 void FF_ReleaseSemaphore(void *pSemaphore) {
78 // Call your OS's ReleaseSemaphore with the provided pSemaphore pointer.
79 //
80
81 //
82 pSemaphore = 0;
83 }
84
85 void FF_DestroySemaphore(void *pSemaphore) {
86 // Call your OS's DestroySemaphore with the provided pSemaphore pointer.
87 //
88
89 //
90 pSemaphore = 0;
91 }
92
93 void FF_Yield(void) {
94 // Call your OS's thread Yield function.
95 // If this doesn't work, then a deadlock will occur
96 }
97
98 void FF_Sleep(FF_T_UINT32 TimeMs) {
99 // Call your OS's thread sleep function,
100 // Sleep for TimeMs milliseconds
101 TimeMs = 0;
102 }
103
104
105 /**
106 * Notes on implementation.
107 *
108 *
109 *
110 **/
111
112