1 //
2 // aegis - project change supervisor
3 // Copyright (C) 2006-2008, 2011, 2012 Peter Miller
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see
17 // <http://www.gnu.org/licenses/>.
18 //
19
20 #include <common/ac/assert.h>
21
22 #include <common/trace.h>
23 #include <libaegis/change.h>
24 #include <libaegis/lock.h>
25 #include <libaegis/project.h>
26 #include <libaegis/sub.h>
27 #include <libaegis/user.h>
28
29
30 static void
waiting_for_lock(void * p)31 waiting_for_lock(void *p)
32 {
33 project *pp = (project *)p;
34 if (user_ty::create()->lock_wait())
35 project_error(pp, 0, i18n("waiting for lock"));
36 else
37 project_fatal(pp, 0, i18n("lock not available"));
38 }
39
40
41 void
pstate_lock_prepare()42 project::pstate_lock_prepare()
43 {
44 trace(("project::pstate_lock_prepare(this = %p)\n{\n", this));
45 if (parent)
46 {
47 assert(pcp);
48 change_cstate_lock_prepare(change_get());
49 }
50 else
51 lock_prepare_pstate(name, waiting_for_lock, this);
52 trace(("}\n"));
53 }
54
55
56 // vim: set ts=8 sw=4 et :
57