Subversion Repositories HelenOS

Rev

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

Rev 1866 Rev 1868
Line 59... Line 59...
59
/** Thread-local count of serialization. If >0, we must not preempt */
59
/** Thread-local count of serialization. If >0, we must not preempt */
60
static __thread int serialization_count;
60
static __thread int serialization_count;
61
/** Counter of threads residing in async_manager */
61
/** Counter of threads residing in async_manager */
62
static int threads_in_manager;
62
static int threads_in_manager;
63
 
63
 
64
/** Setup PSthread information into TCB structure */
64
/** Setup psthread information into TCB structure */
65
psthread_data_t * psthread_setup()
65
psthread_data_t * psthread_setup()
66
{
66
{
67
    psthread_data_t *pt;
67
    psthread_data_t *pt;
68
    tcb_t *tcb;
68
    tcb_t *tcb;
69
 
69
 
Line 87... Line 87...
87
{
87
{
88
    __free_tls(pt->tcb);
88
    __free_tls(pt->tcb);
89
    free(pt);
89
    free(pt);
90
}
90
}
91
 
91
 
92
/** Function that is called on entry to new uspace thread */
92
/** Function that is called on entry to new pseudo thread */
93
void psthread_main(void)
93
void psthread_main(void)
94
{
94
{
95
    psthread_data_t *pt = __tcb_get()->pst_data;
95
    psthread_data_t *pt = __tcb_get()->pst_data;
96
 
96
 
97
    pt->retval = pt->func(pt->arg);
97
    pt->retval = pt->func(pt->arg);
Line 207... Line 207...
207
    psthread_teardown((void *)pt);
207
    psthread_teardown((void *)pt);
208
 
208
 
209
    return retval;
209
    return retval;
210
}
210
}
211
 
211
 
212
/**
-
 
213
 * Create a userspace thread
212
/** Create a userspace pseudo thread.
214
 *
213
 *
215
 * @param func Pseudo thread function.
214
 * @param func Pseudo thread function.
216
 * @param arg Argument to pass to func.
215
 * @param arg Argument to pass to func.
217
 *
216
 *
218
 * @return 0 on failure, TLS of the new pseudo thread.
217
 * @return 0 on failure, TLS of the new pseudo thread.