Subversion Repositories Kolibri OS

Rev

Rev 2352 | Rev 2361 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2352 Rev 2360
Line 1005... Line 1005...
1005
    sna_blit_copy(dst_bitmap, dst_x, dst_y, w, h, src_bitmap, src_x, src_y);
1005
    sna_blit_copy(dst_bitmap, dst_x, dst_y, w, h, src_bitmap, src_x, src_y);
Line 1006... Line 1006...
1006
 
1006
 
Line -... Line 1007...
-
 
1007
};
-
 
1008
 
-
 
1009
 
-
 
1010
void __stdcall run_workqueue(struct workqueue_struct *cwq)
-
 
1011
{
-
 
1012
    unsigned long irqflags;
-
 
1013
 
-
 
1014
//    dbgprintf("wq: %x head %x, next %x\n",
-
 
1015
//               cwq, &cwq->worklist, cwq->worklist.next);
-
 
1016
 
-
 
1017
    spin_lock_irqsave(&cwq->lock, irqflags);
-
 
1018
 
-
 
1019
    while (!list_empty(&cwq->worklist))
-
 
1020
    {
-
 
1021
        struct work_struct *work = list_entry(cwq->worklist.next,
-
 
1022
                                        struct work_struct, entry);
-
 
1023
        work_func_t f = work->func;
-
 
1024
        list_del_init(cwq->worklist.next);
-
 
1025
//        dbgprintf("head %x, next %x\n",
-
 
1026
//                  &cwq->worklist, cwq->worklist.next);
-
 
1027
 
-
 
1028
        spin_unlock_irqrestore(&cwq->lock, irqflags);
-
 
1029
        f(work);
-
 
1030
        spin_lock_irqsave(&cwq->lock, irqflags);
-
 
1031
    }
-
 
1032
 
-
 
1033
    spin_unlock_irqrestore(&cwq->lock, irqflags);
-
 
1034
}
-
 
1035
 
-
 
1036
 
-
 
1037
static inline
-
 
1038
int __queue_work(struct workqueue_struct *wq,
-
 
1039
                         struct work_struct *work)
-
 
1040
{
-
 
1041
    unsigned long flags;
-
 
1042
//    ENTER();
-
 
1043
 
-
 
1044
//    dbgprintf("wq: %x, work: %x\n",
-
 
1045
//               wq, work );
-
 
1046
 
-
 
1047
    if(!list_empty(&work->entry))
-
 
1048
        return 0;
-
 
1049
 
-
 
1050
    spin_lock_irqsave(&wq->lock, flags);
-
 
1051
 
-
 
1052
    if(list_empty(&wq->worklist))
-
 
1053
        TimerHs(0,0, run_workqueue, wq);
-
 
1054
 
-
 
1055
    list_add_tail(&work->entry, &wq->worklist);
-
 
1056
 
-
 
1057
    spin_unlock_irqrestore(&wq->lock, flags);
-
 
1058
//    dbgprintf("wq: %x head %x, next %x\n",
-
 
1059
//               wq, &wq->worklist, wq->worklist.next);
-
 
1060
 
-
 
1061
//    LEAVE();
-
 
1062
    return 1;
-
 
1063
};
-
 
1064
 
-
 
1065
void __stdcall delayed_work_timer_fn(unsigned long __data)
-
 
1066
{
-
 
1067
//    ENTER();
-
 
1068
    struct delayed_work *dwork = (struct delayed_work *)__data;
-
 
1069
    struct workqueue_struct *wq = dwork->work.data;
-
 
1070
 
-
 
1071
//    dbgprintf("wq: %x, work: %x\n",
-
 
1072
//               wq, &dwork->work );
-
 
1073
 
-
 
1074
    __queue_work(wq, &dwork->work);
-
 
1075
//    LEAVE();
-
 
1076
}
-
 
1077
 
-
 
1078
 
-
 
1079
int queue_delayed_work_on(struct workqueue_struct *wq,
-
 
1080
                        struct delayed_work *dwork, unsigned long delay)
-
 
1081
{
-
 
1082
    struct work_struct *work = &dwork->work;
-
 
1083
 
-
 
1084
    work->data = wq;
-
 
1085
    TimerHs(0,0, delayed_work_timer_fn, dwork);
-
 
1086
    return 1;
-
 
1087
}
-
 
1088
 
-
 
1089
int queue_delayed_work(struct workqueue_struct *wq,
-
 
1090
                        struct delayed_work *dwork, unsigned long delay)
-
 
1091
{
-
 
1092
    u32  flags;
-
 
1093
//    ENTER();
-
 
1094
 
-
 
1095
//    dbgprintf("wq: %x, work: %x\n",
-
 
1096
//               wq, &dwork->work );
-
 
1097
 
-
 
1098
    if (delay == 0)
-
 
1099
        return __queue_work(wq, &dwork->work);
-
 
1100
 
-
 
1101
    return queue_delayed_work_on(wq, dwork, delay);
-
 
1102
}
-
 
1103
 
-
 
1104
 
-
 
1105
struct workqueue_struct *alloc_workqueue(const char *fmt,
-
 
1106
                           unsigned int flags,
-
 
1107
                           int max_active)
-
 
1108
{
-
 
1109
    struct workqueue_struct *wq;
-
 
1110
 
-
 
1111
    wq = kzalloc(sizeof(*wq),0);
-
 
1112
    if (!wq)
-
 
1113
        goto err;
-
 
1114
 
-
 
1115
    INIT_LIST_HEAD(&wq->worklist);
-
 
1116
 
-
 
1117
    return wq;
-
 
1118
err:
-
 
1119
    return NULL;
-
 
1120
}
-
 
1121
 
-
 
1122
>
-
 
1123