2 Copyright (C) 2004-2006 Grame
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __JackWinProcessSync__
21 #define __JackWinProcessSync__
23 #include "JackSyncInterface.h"
31 \brief A synchronization primitive built using a condition variable.
34 class JackWinProcessSync
: public JackSyncInterface
45 fEvent
= CreateEvent(NULL
, FALSE
, FALSE
, NULL
);
47 throw new std::bad_alloc
;
49 virtual ~JackWinProcessSync()
54 bool Allocate(const char* name
)
59 bool Connect(const char* name
)
67 bool TimedWait(long usec
)
69 JackLog("JackWinProcessSync::Wait time out = %ld\n", usec
);
70 DWORD res
= WaitForSingleObject(fEvent
, usec
/ 1000);
71 JackLog("JackWinProcessSync::Wait finished res = %ld\n", res
== WAIT_OBJECT_0
);
72 return (res
== WAIT_OBJECT_0
);
77 JackLog("JackWinProcessSync::Wait...\n");
78 WaitForSingleObject(fEvent
, INFINITE
);
79 JackLog("JackWinProcessSync::Wait finished\n");