Subversion Repositories HelenOS-historic

Rev

Rev 1709 | Rev 1720 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1709 Rev 1719
Line 24... Line 24...
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
27
 */
28
 
28
 
29
 /** @addtogroup libc
29
/** @addtogroup libc
30
 * @{
30
 * @{
31
 */
31
 */
32
/** @file
32
/** @file
33
 */
33
 */
34
 
34
 
Line 49... Line 49...
49
 
49
 
50
static LIST_INITIALIZE(ready_list);
50
static LIST_INITIALIZE(ready_list);
51
static LIST_INITIALIZE(serialized_list);
51
static LIST_INITIALIZE(serialized_list);
52
static LIST_INITIALIZE(manager_list);
52
static LIST_INITIALIZE(manager_list);
53
 
53
 
54
static void psthread_exit(void) __attribute__ ((noinline));
-
 
55
static void psthread_main(void);
54
static void psthread_main(void);
56
 
55
 
57
static atomic_t psthread_futex = FUTEX_INITIALIZER;
56
static atomic_t psthread_futex = FUTEX_INITIALIZER;
58
/** Count of real threads that are in async_serialized mode */
57
/** Count of real threads that are in async_serialized mode */
59
static int serialized_threads; /* Protected by async_futex */
58
static int serialized_threads; /* Protected by async_futex */
Line 189... Line 188...
189
 *
188
 *
190
 * @return Value returned by the finished thread.
189
 * @return Value returned by the finished thread.
191
 */
190
 */
192
int psthread_join(pstid_t psthrid)
191
int psthread_join(pstid_t psthrid)
193
{
192
{
194
    volatile psthread_data_t *pt, *mypt;
193
    volatile psthread_data_t *pt;
195
    volatile int retval;
194
    volatile int retval;
196
 
195
 
197
    /* Handle psthrid = Kernel address -> it is wait for call */
196
    /* Handle psthrid = Kernel address -> it is wait for call */
198
    pt = (psthread_data_t *) psthrid;
197
    pt = (psthread_data_t *) psthrid;
199
 
198
 
Line 236... Line 235...
236
    pt->finished = 0;
235
    pt->finished = 0;
237
    pt->waiter = NULL;
236
    pt->waiter = NULL;
238
    pt->flags = 0;
237
    pt->flags = 0;
239
 
238
 
240
    context_save(&pt->ctx);
239
    context_save(&pt->ctx);
241
    context_set(&pt->ctx, FADDR(psthread_main), pt->stack, PSTHREAD_INITIAL_STACK_PAGES_NO*getpagesize(),
240
    context_set(&pt->ctx, FADDR(psthread_main), pt->stack, PSTHREAD_INITIAL_STACK_PAGES_NO*getpagesize(), pt->tcb);
242
            pt->tcb);
-
 
243
 
241
 
244
    return (pstid_t )pt;
242
    return (pstid_t )pt;
245
}
243
}
246
 
244
 
247
/** Add a thread to ready list */
245
/** Add a thread to ready list */
Line 305... Line 303...
305
{
303
{
306
    serialization_count--;
304
    serialization_count--;
307
}
305
}
308
 
306
 
309
 
307
 
310
 /** @}
308
/** @}
311
 */
309
 */
312
 
-
 
313
 
-