Changeset 201abde in mainline for uspace


Ignore:
Timestamp:
2007-04-07T20:06:52Z (18 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7e58979
Parents:
6adbe3c2
Message:

make thread ID 64 bit (task ID is 64 bit already)
cleanup thread syscalls

Location:
uspace
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/libc/generic/thread.c

    r6adbe3c2 r201abde  
    125125 * @param arg Argument to be passed to thread.
    126126 * @param name Symbolic name of the thread.
    127  *
    128  * @return TID of the new thread on success or -1 on failure.
    129  */
    130 int thread_create(void (* function)(void *), void *arg, char *name)
     127 * @param tid Thread ID of the newly created thread.
     128 *
     129 * @return Zero on success or a code from @ref errno.h on failure.
     130 */
     131int thread_create(void (* function)(void *), void *arg, char *name, thread_id_t *tid)
    131132{
    132133        char *stack;
     
    149150        uarg->uspace_uarg = uarg;
    150151       
    151         return __SYSCALL2(SYS_THREAD_CREATE, (sysarg_t) uarg, (sysarg_t) name);
     152        return __SYSCALL3(SYS_THREAD_CREATE, (sysarg_t) uarg, (sysarg_t) name, (sysarg_t) tid);
    152153}
    153154
     
    167168 * @param thread TID.
    168169 */
    169 void thread_detach(int thread)
     170void thread_detach(thread_id_t thread)
    170171{
    171172}
     
    179180 * @return Thread exit status.
    180181 */
    181 int thread_join(int thread)
     182int thread_join(thread_id_t thread)
    182183{
    183184}
     
    187188 * @return Current thread ID.
    188189 */
    189 int thread_get_id(void)
    190 {
    191         return __SYSCALL0(SYS_THREAD_GET_ID);
     190thread_id_t thread_get_id(void)
     191{
     192        thread_id_t thread_id;
     193
     194        (void) __SYSCALL1(SYS_THREAD_GET_ID, (sysarg_t) &thread_id);
     195
     196        return thread_id;
    192197}
    193198
  • uspace/libc/include/thread.h

    r6adbe3c2 r201abde  
    4040#include <types.h>
    4141
     42typedef uint64_t thread_id_t;
     43
    4244extern void __thread_entry(void);
    4345extern void __thread_main(uspace_arg_t *uarg);
    4446
    45 extern int thread_create(void (* function)(void *arg), void *arg, char *name);
     47extern int thread_create(void (* function)(void *), void *arg, char *name, thread_id_t *tid);
    4648extern void thread_exit(int status);
    47 extern void thread_detach(int thread);
    48 extern int thread_join(int thread);
    49 extern int thread_get_id(void);
     49extern void thread_detach(thread_id_t thread);
     50extern int thread_join(thread_id_t thread);
     51extern thread_id_t thread_get_id(void);
    5052extern tcb_t * __make_tls(void);
    5153extern tcb_t * __alloc_tls(void **data, size_t size);
  • uspace/tester/thread/thread1.c

    r6adbe3c2 r201abde  
    4646        while (atomic_get(&finish)) {
    4747                if (!sh_quiet)
    48                         printf("%d ", thread_get_id());
     48                        printf("%llu ", thread_get_id());
    4949                usleep(100000);
    5050        }
     
    6161
    6262        for (i = 0; i < THREADS; i++) { 
    63                 int t;
    64                 if ((t = thread_create(threadtest, NULL, "threadtest")) < 0) {
     63                if (thread_create(threadtest, NULL, "threadtest", NULL) < 0) {
    6564                        if (!quiet)
    6665                                printf("Could not create thread %d\n", i);
Note: See TracChangeset for help on using the changeset viewer.