1 |
/* |
2 |
* HT Editor |
3 |
* sysinit.cc - BeOS-specific initialization |
4 |
* |
5 |
* Copyright (C) 1999-2002 Stefan Weyergraf |
6 |
* Copyright (C) 2004 Francois Revol (revol@free.fr) |
7 |
* |
8 |
* This program is free software; you can redistribute it and/or modify |
9 |
* it under the terms of the GNU General Public License version 2 as |
10 |
* published by the Free Software Foundation. |
11 |
* |
12 |
* This program is distributed in the hope that it will be useful, |
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
* GNU General Public License for more details. |
16 |
* |
17 |
* You should have received a copy of the GNU General Public License |
18 |
* along with this program; if not, write to the Free Software |
19 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 |
*/ |
21 |
|
22 |
#include <signal.h> |
23 |
#include <unistd.h> |
24 |
#include <sys/types.h> |
25 |
|
26 |
#include <Application.h> |
27 |
#include <OS.h> |
28 |
|
29 |
#include "system/sys.h" |
30 |
|
31 |
int32 bapp_thread(void *) |
32 |
{ |
33 |
be_app->Lock(); |
34 |
be_app->Run(); |
35 |
} |
36 |
|
37 |
bool initOSAPI() |
38 |
{ |
39 |
thread_id bapp_tid; |
40 |
setuid(getuid()); |
41 |
new BApplication("application/x-vnd.PearPC"); |
42 |
if (!be_app) |
43 |
return false; |
44 |
bapp_tid = spawn_thread(bapp_thread, "BApplication(PearPC)", B_NORMAL_PRIORITY, NULL); |
45 |
if (bapp_tid < B_OK) |
46 |
return false; |
47 |
if (resume_thread(bapp_tid) < B_OK) |
48 |
return false; |
49 |
be_app->Unlock(); |
50 |
return true; |
51 |
} |
52 |
|
53 |
void doneOSAPI() |
54 |
{ |
55 |
be_app->Lock(); |
56 |
be_app->Quit(); |
57 |
delete be_app; |
58 |
} |