亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ctask.doc

?? 一個可以立即使用的嵌入式操作系統
?? DOC
?? 第 1 頁 / 共 5 頁
字號:
          2) Task1 runs up to "temp = val", then is interrupted by the
             timer. Task2 executes, and gets 14 as result. Then Task1
             continues. Return for Task1 is 14.

          3) Task2 runs up to "temp = val", then is interrupted by the
             timer. Task1 executes, and gets 6 as result. Then Task2
             continues. Return for Task2 is 6.

        add to this the effects of optimization, and a loop, and the
        outcome is completely random.

        Most routines in the C library will not explicitly do something
        like this, but all functions that

             - do file I/O (read, write, printf, scanf, etc.) or
             - change memory allocation (malloc, free, etc.)


        
        
        Ctask Manual       - Version 2.2 - 90-10-12 -             Page 12


        have to use some static data to do buffering, or to store the
        chain of memory blocks in. Interrupting such an operation may
        have disastrous effects. The most devilish aspect of non-
        reentrancy is that the effects are unpredictable. Your program
        may run 1000 times without any error, and then on the 1001th time
        crash the system so completely that only the big red switch will
        help.

        So what can you do about it? A lot. There are several ways to
        protect "critical regions" from being entered in parallel. The
        most simple method is to disable interrupts. This, however,
        should be used only for *very* short periods of time, and not for
        rou-tines that might themselves re-enable them (like file-I/O). A
        better method is to temporarily disable task preemption. The
        routines tsk_dis_preempt and tsk_ena_preempt allow this form of
        short-term task switch disable. Interrupts may still be
        processed, but tasks will not be preempted. The best way is to
        use a "resource". A resource is a special kind of event, which
        only one task can possess at a time. Requesting the resource
        before entering the routine, and releasing it afterwards, will
        protect you from any other task simultaneously entering the
        critical region (assuming that this task also requests the
        resource).

        It is also reasonably safe to use file-I/O without protection if
        it goes to different files. The C file control blocks for
        different files are distinct, so there will be no conflict
        between tasks. Since DOS access is automatically protected by
        CTask, concurrent file I/O is possible.

        What you may NEVER do is to use a non-reentrant routine that is
        not protected by an interrupt disable from an interrupt handler.
        An interrupt handler is not a task, and so can not safely request
        a resource or disable task preemption. This is the reason why the
        CTask routines generally disable interrupts before manipulating
        the internal queues rather than only disabling task preemption.


                                    Deadlocks

        One thing to watch out for when using resources or similar event
        mechanisms is not to get into a situation where Task 1 waits for
        a resource that Task 2 has requested, while at the same time Task
        2 waits for a resource that Task 1 already has. This situation is
        called a deadlock (or, more picturesque, deadly embrace), and it
        can only be resolved with outside help (e.g. waking up one of the
        tasks forcibly). To illustrate, consider the following example:






        
        
        Ctask Manual       - Version 2.2 - 90-10-12 -             Page 13


             void far task_1 ()
             {
               ...
               request_resource (&rsc1, 0L);
               request_resource (&rsc2, 0L);
               ...
             }

             void far task_2 ()
             {
               ...
               request_resource (&rsc2, 0L);
               request_resource (&rsc1, 0L);
               ...
             }

        Since interrupts are always enabled on return from a task switch,
        even if the statements are enclosed in a critical region, there
        is no guarantee that the request_resource calls will be executed
        without interruption. In this example, the problem is obvious,
        but in a more complex application, where resource requests or
        other waits might be buried in some nested routine, you should
        watch out for similar situations. One way to avoid problems would
        be in this example to change task_2 to

             void far task_2 ()
             {
                  int again;
                  ...
                  do {
                       request_resource (&rsc2, 0L);
                       if (again = c_request_resource (&rsc1))
                          {
                          release_resource (&rsc2);
                          delay (2L);
                          }
                     } while (again);
                  ...
             }

        Note that this is only one of many possible approaches, and that
        this approach favors task_1 over task_2.

        You should also take care not to kill tasks that currently own a
        resource. CTask will not detect this, and the resource will never
        be freed.







        
        
        Ctask Manual       - Version 2.2 - 90-10-12 -             Page 14


                                   Using CTask

        CTask comes archived with both source and binaries. The binary
        version is compiled in the large model, but since the precompiled
        kernel routines don't use any functions from the C library, you
        can use all functions in small or other model programs (except
        Turbo C's Tiny and Huge models). The include files provided
        specify all model dependencies, so you don't have to use the
        large model for your application, but always remember to include
        "tsk.h" for the type definitions and function prototypes.

        The C source files will work without changes for both Microsoft
        and Turbo C. The library files are not compatible, so use
        "ctaskms.lib" for Microsoft, and "ctasktc.lib" for Turbo C.

        In the distributed configuration (i.e. dynamic allocation of
        control blocks enabled), the file TSKALLOC.C must be added to the
        library or separately linked after compiling it *in the same
        model as the main program*. This file uses C-library routines,
        and thus must match the main program's memory model. The same
        goes for TSKSNAP.C, an optional snapshot-dump utility, and
        CONOUT.C, the sample console output handler. The provided
        "ctsupms.lib" and "ctsuptc.lib" files have been compiled in the
        large model, and may only be used with large model programs.

        Turbo C's huge model uses a different segment setup for data
        segments. This requires using a special data segment for all
        CTask data, and compilation of the CTask kernel in huge model.
        For the assembler files, the symbol TC_HUGE must be defined
        during assembly, the C files must be compiled with the Data-
        Segment and BSS-Segment naming options. Make-files for Turbo C
        Huge model are included.


                              Configuration Options

        The file TSKCONF.H contains a number of #define's that allow you
        to configure some CTask features. In general, you should
        recompile all of CTask when changing one of the flags. Version
        2.1 collects all configuration options for both Assembler and C
        in this file.

        The entries are

        CODE_SHARING
             If TRUE, the generated kernel supports code sharing. This
             requires the entry points to load DS on entry, and compi-
             lation with Large model (MSC) or Huge model (TC).

             This option is normally disabled (FALSE).



        
        
        Ctask Manual       - Version 2.2 - 90-10-12 -             Page 15


        NEAR_CODE
             If TRUE, all CTask routines are 'near'. Use only with small
             or compact model. You will have to change the make-files so
             the compiler model is no longer Large, and the code segment
             is not named, when turning on this flag. The default is
             FALSE. Setting this option TRUE will save code, and make
             calls faster, but the library will no longer be model
             independent.

             This option is normally disabled (FALSE).

        LOCALS_FAR
             If TRUE, internal CTask routines ar 'far'. This might be
             necessary if your compiler/linker does not allow placing all
             CTask kernel code in a common segment. Do not set this flag
             if NEAR_CODE is set.

             This option is normally disabled (FALSE).

        CALL_PASCAL
             Use Pascal calling sequence for CTask routines.  This may
             save some code, but may cause naming conflicts if your
             compiler limits external Pascal names to 8 characters.

             This option is normally disabled (FALSE).

        TC_HUGE
             (Assembler only) Define TC_HUGE for use with the Turbo C
             Huge model, and if it is desired to separate CTask's data
             from the normal data segment. This flag causes the
             CTASK_DATA segment to be defined, (class is DATA) and DS to
             be loaded with this segment on function entry. The C
             functions in the CTask kernel must be compiled to use the
             same data segment.

             This option is normally disabled (undefined).

        LOAD_DS
             (Assembler only) Define LOAD_DS to reload the data segment
             on entry to global functions. This flag must be defined for
             TC_HUGE. It can also be defined if the data segment can not
             safely be assumed to be loaded in DS on function entry, for
             example if the code sharing feature of version 2.1 is used.
             The C routines must be compiled with the necessary compiler
             switches or the _loadds keyword in this case.

             This option is normally disabled (undefined).






        
        
        Ctask Manual       - Version 2.2 - 90-10-12 -             Page 16


        ROM_CODE
             (Assembler only) Define ROM_CODE TRUE for embedded systems
             using ROM-based code. This option disables storing variables
             in the code segment in some modules. Note that most DOS-
             related modules are not ROMable.

             This option is normally disabled (FALSE).

        FAR_STACK
             (Assembler only) Define FAR_STACK TRUE to save some space in
             the default DGROUP. With this define TRUE, the local stacks
             for the scheduler, the timer, and the interrupt handlers,
             are allocated in a separate segment. With Turbo C, you may
             have to edit the "c0.asm" startup module to accomodate the
             new segment.

             This option is normally disabled (FALSE).

        TSK_DYNAMIC
             If TRUE, you can let CTask dynamically create task and event
             control blocks, task stacks, and pipe buffers, by passing
             NULL as the block address. Since this requires the C runtime
             allocation calls, it is not suitable for non-DOS appli-
             cations (except if you provide your own memory allocation
             routines).

             This option is normally enabled (TRUE).

        TSK_DYNLOAD
             If FALSE, this instance of the kernel does not include
             dynamic allocation routines. Setting this flag to FALSE when
             TSK_DYNAMIC is TRUE only makes sense with multiple linked
             kernels. A resident kernel might not employ dynamic
             allocation, whereas a secondary kernel needs it. In this
             situation, TSK_DYNAMIC must be set in the primary so that
             the task kill code is included and the kernel configurations
             match, but TSK_DYNLOAD may be false to prevent inclusion of

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲va欧美va国产va天堂影院| 一区二区三区精品视频| 日韩片之四级片| 欧美三级日韩在线| 欧美区一区二区三区| 欧美日韩国产在线播放网站| 欧美日韩成人激情| 日韩色视频在线观看| 精品av久久707| 国产欧美一区二区精品性色| 国产欧美日韩另类一区| 中文字幕免费一区| 一区二区三区日本| 日韩福利视频网| 国产美女精品人人做人人爽| 国产超碰在线一区| 色综合久久久久综合体| 欧美亚洲动漫制服丝袜| 91精品视频网| 国产日韩欧美综合一区| 中文字幕成人网| 亚洲成人www| 国产精品一二三| 色综合天天在线| 日韩小视频在线观看专区| 久久久久国产精品厨房| 一区二区三区在线视频观看58| 亚洲午夜一二三区视频| 精品中文字幕一区二区小辣椒| 成人亚洲精品久久久久软件| 欧美综合亚洲图片综合区| 精品处破学生在线二十三| 亚洲欧美精品午睡沙发| 捆绑变态av一区二区三区| 成人毛片老司机大片| 欧美日韩aaaaa| 亚洲欧洲国产日韩| 免费观看成人鲁鲁鲁鲁鲁视频| 国产成人av影院| 日韩小视频在线观看专区| 最新中文字幕一区二区三区| 久久成人久久爱| 欧美日韩精品系列| 国产精品国产三级国产aⅴ入口| 五月婷婷欧美视频| 成人激情免费电影网址| 精品国产亚洲在线| 天天综合网天天综合色| 91麻豆免费看| 国产欧美精品区一区二区三区| 午夜视频一区在线观看| 99精品黄色片免费大全| 久久蜜桃av一区精品变态类天堂 | 日韩国产精品久久| 9久草视频在线视频精品| 日韩欧美一级在线播放| 丝袜脚交一区二区| 欧美亚洲国产一区二区三区va| 国产精品你懂的| 国产精品99久久久| 久久综合九色综合97_久久久| 日韩va亚洲va欧美va久久| 91在线高清观看| 亚洲国产精华液网站w| 狠狠色丁香久久婷婷综| 欧美一级黄色录像| 免费高清成人在线| 欧美岛国在线观看| 激情综合五月婷婷| 精品国产第一区二区三区观看体验| 日本aⅴ免费视频一区二区三区| 欧美日韩午夜在线视频| 日韩精品午夜视频| 日韩欧美电影一二三| 国产最新精品精品你懂的| 久久男人中文字幕资源站| 国产精品一区二区无线| 久久免费国产精品| 懂色一区二区三区免费观看| 国产日产欧美一区| 色综合一区二区三区| 亚洲美女免费在线| hitomi一区二区三区精品| 中文字幕一区二区日韩精品绯色| 99久久免费视频.com| 亚洲综合一二区| 91精品国产综合久久久久 | 日韩女优视频免费观看| 国内外成人在线| 中文字幕不卡的av| 色天使久久综合网天天| 亚洲最快最全在线视频| 777久久久精品| 国产米奇在线777精品观看| 中文字幕视频一区二区三区久| 一本大道久久a久久精品综合| 亚洲大尺度视频在线观看| 精品久久久三级丝袜| 成人激情综合网站| 婷婷综合久久一区二区三区| 精品国免费一区二区三区| 成人av动漫在线| 婷婷中文字幕一区三区| 国产欧美日韩综合精品一区二区| 99视频国产精品| 美女网站一区二区| 国产精品久久一卡二卡| 欧美妇女性影城| 处破女av一区二区| 亚洲大片一区二区三区| 中文字幕国产一区| 欧美一级日韩免费不卡| jlzzjlzz国产精品久久| 老司机精品视频导航| 亚洲夂夂婷婷色拍ww47 | youjizz久久| 美日韩黄色大片| 亚洲国产日产av| 中文字幕中文字幕一区二区| 日韩女优制服丝袜电影| 欧美丝袜丝交足nylons| 粉嫩aⅴ一区二区三区四区五区| 日韩精品午夜视频| 亚洲青青青在线视频| 久久一区二区三区四区| 欧美日韩高清一区二区三区| 成人av动漫在线| 国产高清视频一区| 日本aⅴ免费视频一区二区三区 | 日韩免费福利电影在线观看| av电影天堂一区二区在线观看| 久久精品国产第一区二区三区| 一二三区精品视频| 中文av字幕一区| 久久精品视频在线免费观看| 欧美精品一卡二卡| 色94色欧美sute亚洲线路二| 风间由美性色一区二区三区| 美国三级日本三级久久99| 亚洲高清中文字幕| 亚洲精品视频免费看| 亚洲免费av在线| 亚洲精品精品亚洲| 国产精品久久久久久福利一牛影视| 久久丝袜美腿综合| ww久久中文字幕| 久久综合九色综合久久久精品综合| 日韩欧美一二三| 91精品免费观看| 欧美一区二区三区在线看| 91精品国产乱码| 欧美一区二区三区成人| 欧美精品第一页| 欧美一区二区三区喷汁尤物| 日韩精品一区二区三区视频在线观看| 欧美一区二区播放| 精品久久久久久无| 久久久久久99久久久精品网站| 久久久www成人免费毛片麻豆| 久久综合久久99| 中文字幕亚洲一区二区va在线| 中文字幕日韩精品一区| 亚洲精品乱码久久久久| 天天射综合影视| 国产乱色国产精品免费视频| 成人免费视频国产在线观看| 99久久久无码国产精品| 一本到不卡免费一区二区| 欧美精品乱码久久久久久| 欧美一级黄色大片| 国产日韩欧美制服另类| 亚洲激情图片一区| 免费观看在线色综合| 成人午夜精品在线| 91热门视频在线观看| 91精品国产欧美一区二区成人| 久久综合九色综合久久久精品综合| 国产精品午夜久久| 午夜欧美在线一二页| 国产乱码精品一区二区三区av| www.久久精品| 91精品国产日韩91久久久久久| 国产人成亚洲第一网站在线播放| 亚洲一区二区三区自拍| 国产一区二区剧情av在线| 欧洲中文字幕精品| 久久久www成人免费毛片麻豆 | 国产精品久久久久久妇女6080| 亚洲永久免费av| 国产一区二区三区四区五区入口| 成年人网站91| 欧美精品黑人性xxxx| 国产精品高清亚洲| 狠狠v欧美v日韩v亚洲ⅴ| 91传媒视频在线播放| 久久这里只有精品6| 悠悠色在线精品| 成人一级片在线观看| 日韩精品最新网址| 亚洲成人精品一区二区|