Subversion Repositories Kolibri OS

Rev

Rev 1238 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1238 Rev 1286
Line 16... Line 16...
16
 *  Kobra (Kolibri Bus for Reaching Applications) is daemon for advanced & easier applications     *
16
 *  Kobra (Kolibri Bus for Reaching Applications) is daemon for advanced & easier applications     *
17
 *  communication.                                                                                 *
17
 *  communication.                                                                                 *
18
 ***************************************************************************************************/
18
 ***************************************************************************************************/
Line 19... Line 19...
19
 
19
 
20
#include "kobra.h"
20
#include "kobra.h"
21
#include "heap.h"
21
#include 
22
#include "malloc.h"
22
#include 
23
#include "kolibri.h"
23
#include 
24
#include "defs.h"
24
#include 
-
 
25
#include 
Line 25... Line 26...
25
#include "stdlib.h"
26
#include 
26
 
27
 
Line 27... Line 28...
27
group_list_t *main_group_list;
28
group_list_t *main_group_list;
Line 53... Line 54...
53
	create_group("main");
54
	create_group("main");
54
	main_group_list->next = main_group_list->previos = main_group_list;
55
	main_group_list->next = main_group_list->previos = main_group_list;
55
	main_group_list->thread_list = main_thread_list = new_thread_list(kolibri_get_my_tid());
56
	main_group_list->thread_list = main_thread_list = new_thread_list(kolibri_get_my_tid());
56
	main_thread_list->next = main_thread_list->previos = main_thread_list;
57
	main_thread_list->next = main_thread_list->previos = main_thread_list;
Line 57... Line 58...
57
	
58
	
58
	kolibri_IPC_init(malloc(0x1000), 0x1000);
59
	IPCInit();
Line 59... Line 60...
59
	kolibri_IPC_unlock();
60
// 	kolibri_IPC_unlock();
60
	
61
	
Line 61... Line 62...
61
	// Set event mask
62
	// Set event mask
-
 
63
// 	kolibri_event_set_mask(KOLIBRI_IPC_EVENT_MASK);
62
	kolibri_set_event_mask(KOLIBRI_IPC_EVENT_MASK);
64
	
63
	
65
	while (1) {
64
	while (1) {
66
		Message *msg = IPCWaitMessage(-1);
65
		if (kolibri_event_wait() != KOLIBRI_IPC_EVENT) {		// Just ignore this error
-
 
66
			continue;
67
// 		if (kolibri_event_wait() != KOLIBRI_IPC_EVENT) {		// Just ignore this error
-
 
68
// 			continue;
67
		}
69
// 		}
68
		
70
		message_handle(msg);
69
		message_handle(kolibri_IPC_get_next_message());
71
		free(msg);
Line 70... Line 72...
70
		kolibri_IPC_clear_buff();
72
// 		kolibri_IPC_clear_buff();
71
	}
73
	}
Line 206... Line 208...
206
	
208
	
207
	((unsigned long *)msg)[0] = (unsigned long)tid;
209
	((unsigned long *)msg)[0] = (unsigned long)tid;
Line 208... Line 210...
208
	memcpy(msg+4, message, length);
210
	memcpy(msg+4, message, length);
209
	
211
	
210
	do {
212
	do {
211
		kolibri_IPC_send(thread->tid, msg, length+sizeof(int));
213
		IPCSend(thread->tid, msg, length+sizeof(int));		// Here may be some errror handler
212
		thread = thread->next;
214
		thread = thread->next;
Line 213... Line 215...
213
	} while (thread != thread_list);
215
	} while (thread != thread_list);