Changeset 29a9f62 in mainline for init/init.c


Ignore:
Timestamp:
2006-03-23T10:33:55Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
77bd004
Parents:
1cef26f
Message:

Added symbolic links 'libarch','libadt','libipc' into libc/include,
so that it can be easily used from anywhere.
Renamed thread_main to thread_main.
Allowed MIPS to compile with -O0.
Added non-preemptible threads support (not yet secured by futexes).
Added simple way to hold Thread Local Storage. Support for compiler
will be added later.
This update breaks IA64 uspace.

There is some forgotten spinlock_lock() in futexes, amd64 gets locked
in the secod uspace thread probably with preemption disabled.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • init/init.c

    r1cef26f r29a9f62  
    3434#include <ns.h>
    3535#include <thread.h>
     36#include <psthread.h>
    3637#include <futex.h>
    3738
     
    253254}
    254255
    255 
     256static int ptest(void *arg)
     257{
     258        printf("Pseudo thread-1\n");
     259        ps_preempt();
     260        printf("Pseudo thread-2\n");
     261        ps_preempt();
     262        printf("Pseudo thread-3\n");
     263        ps_preempt();
     264        printf("Pseudo thread-4\n");
     265        ps_preempt();
     266        printf("Pseudo finish\n");
     267        return 0;       
     268}
    256269
    257270int main(int argc, char *argv[])
    258271{
     272        pstid_t ptid;
    259273        int tid;
     274
    260275        version_print();
    261276
     
    274289                printf("Futex failed.\n");
    275290
     291        if ((tid = thread_create(utest, NULL, "utest") != -1)) {
     292                printf("Created thread tid=%d\n", tid);
     293        }
     294
    276295        if (futex_down(&ftx) < 0)
    277296                printf("Futex failed.\n");
     
    289308                printf("Futex failed.\n");
    290309
     310        ptid = psthread_create(ptest, NULL);
     311        printf("Main thread-1\n");
     312        ps_preempt();
     313        printf("Main thread-2\n");
     314        ps_preempt();
     315        printf("main thread-3\n");
     316
     317        ps_join(ptid);
     318        printf("Main exiting\n");
     319
    291320        printf("Main thread exiting.\n");
    292321        return 0;
Note: See TracChangeset for help on using the changeset viewer.