mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-18 20:39:33 +08:00
* sync.h (muto::operator int): New operator.
(locker): Remove unused class. (new_muto): Delete. (new_muto1): Ditto. (new_muto_name): Ditto. * cygheap.cc (cygheap_setup_for_child): Reflect use of static storage for muto rather than pointer. (_csbrk): Ditto. (_cmalloc): Ditto. (_cmalloc): Ditto. (_cfree): Ditto. * cygheap.h (cwdstuff::cwd_lock): Ditto. (cwdstuff::get_drive): Ditto. * cygmalloc.h (__malloc_lock): Ditto. (__malloc_unlock): Ditto. * cygtls.cc (sentry::lock): Ditto. (sentry::sentry): Ditto. (~sentry): Ditto. (_cygtls::init): Ditto. * dcrt0.cc: Ditto. (cygwin_atexit): Ditto. (cygwin_exit): Ditto. * debug.cc (lock_debug::locker): Ditto. (lock_debug::lock_debug): Ditto. (lock_debug::unlock): Ditto. (debug_init): Ditto. * dtable.cc (dtable::init_lock): Ditto. * dtable.h (dtable::lock_cs): Ditto. (dtable::lock): Ditto. (dtable::unlock): Ditto. * exceptions.cc (mask_sync): Ditto. (sighold): Ditto. (set_process_mask_delta): Ditto. (set_signal_mask): Ditto. (events_init): Ditto. * grp.cc (pwdgrp::pwdgrp): Ditto. * malloc_wrapper.cc (mallock): Ditto. (malloc_init): Ditto. * path.cc (cwdstuff::cwd_lock): Ditto. (cwdstuff::get_hash): Ditto. (cwdstuff::get_hash): Ditto. (cwdstuff::init): Ditto. (cwdstuff::set): Ditto. (cwdstuff::get): Ditto. * pwdgrp.h (pwdgrp::pglock): Ditto. (pwdgrp::refresh): Ditto. * sigproc.cc (sync_proc_subproc): Ditto. (get_proc_lock): Ditto. (proc_subproc): Ditto. (_cygtls::remove_wq): Ditto. (proc_terminate): Ditto. (sigproc_init): Ditto. * timer.cc (lock_timer_tracker::protect): Ditto. (lock_timer_tracker::lock_timer_tracker): Ditto. (lock_timer_tracker::~lock_timer_tracker): Ditto. * wininfo.cc (wininfo::_lock;): Ditto. (wininfo::winthread): Ditto. (operator HWND): Ditto. (wininfo::lock): Ditto. (wininfo::release): Ditto. * wininfo.h (wininfo::_lock;): Ditto.
This commit is contained in:
parent
82ae6271ba
commit
322c131f9f
@ -1,3 +1,67 @@
|
|||||||
|
2005-04-05 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
|
* sync.h (muto::operator int): New operator.
|
||||||
|
(locker): Remove unused class.
|
||||||
|
(new_muto): Delete.
|
||||||
|
(new_muto1): Ditto.
|
||||||
|
(new_muto_name): Ditto.
|
||||||
|
* cygheap.cc (cygheap_setup_for_child): Reflect use of static storage
|
||||||
|
for muto rather than pointer.
|
||||||
|
(_csbrk): Ditto.
|
||||||
|
(_cmalloc): Ditto.
|
||||||
|
(_cmalloc): Ditto.
|
||||||
|
(_cfree): Ditto.
|
||||||
|
* cygheap.h (cwdstuff::cwd_lock): Ditto.
|
||||||
|
(cwdstuff::get_drive): Ditto.
|
||||||
|
* cygmalloc.h (__malloc_lock): Ditto.
|
||||||
|
(__malloc_unlock): Ditto.
|
||||||
|
* cygtls.cc (sentry::lock): Ditto.
|
||||||
|
(sentry::sentry): Ditto.
|
||||||
|
(~sentry): Ditto.
|
||||||
|
(_cygtls::init): Ditto.
|
||||||
|
* dcrt0.cc: Ditto.
|
||||||
|
(cygwin_atexit): Ditto.
|
||||||
|
(cygwin_exit): Ditto.
|
||||||
|
* debug.cc (lock_debug::locker): Ditto.
|
||||||
|
(lock_debug::lock_debug): Ditto.
|
||||||
|
(lock_debug::unlock): Ditto.
|
||||||
|
(debug_init): Ditto.
|
||||||
|
* dtable.cc (dtable::init_lock): Ditto.
|
||||||
|
* dtable.h (dtable::lock_cs): Ditto.
|
||||||
|
(dtable::lock): Ditto.
|
||||||
|
(dtable::unlock): Ditto.
|
||||||
|
* exceptions.cc (mask_sync): Ditto.
|
||||||
|
(sighold): Ditto.
|
||||||
|
(set_process_mask_delta): Ditto.
|
||||||
|
(set_signal_mask): Ditto.
|
||||||
|
(events_init): Ditto.
|
||||||
|
* grp.cc (pwdgrp::pwdgrp): Ditto.
|
||||||
|
* malloc_wrapper.cc (mallock): Ditto.
|
||||||
|
(malloc_init): Ditto.
|
||||||
|
* path.cc (cwdstuff::cwd_lock): Ditto.
|
||||||
|
(cwdstuff::get_hash): Ditto.
|
||||||
|
(cwdstuff::get_hash): Ditto.
|
||||||
|
(cwdstuff::init): Ditto.
|
||||||
|
(cwdstuff::set): Ditto.
|
||||||
|
(cwdstuff::get): Ditto.
|
||||||
|
* pwdgrp.h (pwdgrp::pglock): Ditto.
|
||||||
|
(pwdgrp::refresh): Ditto.
|
||||||
|
* sigproc.cc (sync_proc_subproc): Ditto.
|
||||||
|
(get_proc_lock): Ditto.
|
||||||
|
(proc_subproc): Ditto.
|
||||||
|
(_cygtls::remove_wq): Ditto.
|
||||||
|
(proc_terminate): Ditto.
|
||||||
|
(sigproc_init): Ditto.
|
||||||
|
* timer.cc (lock_timer_tracker::protect): Ditto.
|
||||||
|
(lock_timer_tracker::lock_timer_tracker): Ditto.
|
||||||
|
(lock_timer_tracker::~lock_timer_tracker): Ditto.
|
||||||
|
* wininfo.cc (wininfo::_lock;): Ditto.
|
||||||
|
(wininfo::winthread): Ditto.
|
||||||
|
(operator HWND): Ditto.
|
||||||
|
(wininfo::lock): Ditto.
|
||||||
|
(wininfo::release): Ditto.
|
||||||
|
* wininfo.h (wininfo::_lock;): Ditto.
|
||||||
|
|
||||||
2005-04-04 Christopher Faylor <cgf@timesys.com>
|
2005-04-04 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
* path.cc (path_conv::check): Only check for PC_NO_ACCESS_CHECK in end
|
* path.cc (path_conv::check): Only check for PC_NO_ACCESS_CHECK in end
|
||||||
@ -10,13 +74,13 @@
|
|||||||
* fhandler.h (enum change_state): Add.
|
* fhandler.h (enum change_state): Add.
|
||||||
(fhandler_base::status): Add a bit to has_changed flag.
|
(fhandler_base::status): Add a bit to has_changed flag.
|
||||||
(fhandler_base::has_changed): Implement with type change_state.
|
(fhandler_base::has_changed): Implement with type change_state.
|
||||||
* fhandler.cc (fhandler_base::raw_write): Accomodate type change
|
* fhandler.cc (fhandler_base::raw_write): Accommodate type change
|
||||||
of has_changed.
|
of has_changed.
|
||||||
* fhandler_disk_file.cc )fhandler_disk_file::touch_ctime): Also
|
* fhandler_disk_file.cc )fhandler_disk_file::touch_ctime): Also
|
||||||
touch modification time if has_changed == data_changed.
|
touch modification time if has_changed == data_changed.
|
||||||
(fhandler_disk_file::fchmod): Also open on 9x, otherwise we can't
|
(fhandler_disk_file::fchmod): Also open on 9x, otherwise we can't
|
||||||
touch ctime. Accomodate type change of has_changed.
|
touch ctime. Accommodate type change of has_changed.
|
||||||
(fhandler_disk_file::fchown): Accomodate type change of has_changed.
|
(fhandler_disk_file::fchown): Accommodate type change of has_changed.
|
||||||
(fhandler_disk_file::facl): Ditto.
|
(fhandler_disk_file::facl): Ditto.
|
||||||
(fhandler_disk_file::ftruncate): Ditto.
|
(fhandler_disk_file::ftruncate): Ditto.
|
||||||
(fhandler_disk_file::link): Ditto.
|
(fhandler_disk_file::link): Ditto.
|
||||||
@ -24,7 +88,7 @@
|
|||||||
|
|
||||||
2005-04-03 Corinna Vinschen <corinna@vinschen.de>
|
2005-04-03 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* cygheap.cc (cygheap_init): Accomodate set_process_privilege change.
|
* cygheap.cc (cygheap_init): Accommodate set_process_privilege change.
|
||||||
* cygheap.h (cygheap_user::curr_primary_token): New member.
|
* cygheap.h (cygheap_user::curr_primary_token): New member.
|
||||||
(cygheap_user::primary_token): New method.
|
(cygheap_user::primary_token): New method.
|
||||||
(cygheap_user::deimpersonate): Always revert to processes'
|
(cygheap_user::deimpersonate): Always revert to processes'
|
||||||
@ -881,7 +945,7 @@
|
|||||||
(class fhandler_disk_file): Ditto.
|
(class fhandler_disk_file): Ditto.
|
||||||
(class fhandler_dev_mem): Ditto.
|
(class fhandler_dev_mem): Ditto.
|
||||||
* fhandler_mem.cc (fhandler_dev_mem::fixup_mmap_after_fork):
|
* fhandler_mem.cc (fhandler_dev_mem::fixup_mmap_after_fork):
|
||||||
Accomodate new parameters.
|
Accommodate new parameters.
|
||||||
* mmap.cc: Include ntdll.h.
|
* mmap.cc: Include ntdll.h.
|
||||||
(class mmap_record): Add flags member.
|
(class mmap_record): Add flags member.
|
||||||
(mmap_record::mmap_record): Add flags parameter.
|
(mmap_record::mmap_record): Add flags parameter.
|
||||||
@ -893,14 +957,14 @@
|
|||||||
(mmap64): Don't align offset and length to granularity in case of
|
(mmap64): Don't align offset and length to granularity in case of
|
||||||
MAP_ANONYMOUS on NT. Check for already existing mapping only on 9x.
|
MAP_ANONYMOUS on NT. Check for already existing mapping only on 9x.
|
||||||
Call mmap_record::mmap_record with additional flags argument.
|
Call mmap_record::mmap_record with additional flags argument.
|
||||||
(fhandler_base::fixup_mmap_after_fork): Accomodate new parameters.
|
(fhandler_base::fixup_mmap_after_fork): Accommodate new parameters.
|
||||||
(fhandler_disk_file::mmap): Use NtMapViewOfSection with
|
(fhandler_disk_file::mmap): Use NtMapViewOfSection with
|
||||||
AT_ROUND_TO_PAGE flag for anonymous mappings on NT. If addr is NULL,
|
AT_ROUND_TO_PAGE flag for anonymous mappings on NT. If addr is NULL,
|
||||||
try to map adjacent to previous mapping.
|
try to map adjacent to previous mapping.
|
||||||
(fhandler_disk_file::fixup_mmap_after_fork): Add flags argument.
|
(fhandler_disk_file::fixup_mmap_after_fork): Add flags argument.
|
||||||
Change offset parameter to _off64_t. Use NtMapViewOfSection to
|
Change offset parameter to _off64_t. Use NtMapViewOfSection to
|
||||||
re-create anonymous mappings on NT.
|
re-create anonymous mappings on NT.
|
||||||
(fixup_mmaps_after_fork): Accomodate new parameters when calling
|
(fixup_mmaps_after_fork): Accommodate new parameters when calling
|
||||||
fhandler's fixup_mmaps_after_fork function.
|
fhandler's fixup_mmaps_after_fork function.
|
||||||
* ntdll.h (AT_ROUND_TO_PAGE): New define.
|
* ntdll.h (AT_ROUND_TO_PAGE): New define.
|
||||||
|
|
||||||
@ -1019,7 +1083,7 @@
|
|||||||
* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Pass
|
* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Pass
|
||||||
dwVolumeSerialNumber from GetFileInformationByHandle to fstat_helper.
|
dwVolumeSerialNumber from GetFileInformationByHandle to fstat_helper.
|
||||||
(fhandler_base::fstat_by_name): Pass pc.volser () to fstat_helper.
|
(fhandler_base::fstat_by_name): Pass pc.volser () to fstat_helper.
|
||||||
Accomodate dropping default values for last three arguments of
|
Accommodate dropping default values for last three arguments of
|
||||||
fstat_helper.
|
fstat_helper.
|
||||||
(fhandler_base::fstat_helper): Add dwVolumeSerialNumber argument.
|
(fhandler_base::fstat_helper): Add dwVolumeSerialNumber argument.
|
||||||
Use for st_dev member unless 0 in which case pc.volser () is used.
|
Use for st_dev member unless 0 in which case pc.volser () is used.
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
init_cygheap NO_COPY *cygheap;
|
init_cygheap NO_COPY *cygheap;
|
||||||
void NO_COPY *cygheap_max;
|
void NO_COPY *cygheap_max;
|
||||||
|
|
||||||
static NO_COPY muto *cygheap_protect;
|
static NO_COPY muto cygheap_protect;
|
||||||
static NO_COPY DWORD reserve_sz;
|
static NO_COPY DWORD reserve_sz;
|
||||||
|
|
||||||
struct cygheap_entry
|
struct cygheap_entry
|
||||||
@ -100,7 +100,7 @@ void *__stdcall
|
|||||||
cygheap_setup_for_child (child_info *ci, bool dup_later)
|
cygheap_setup_for_child (child_info *ci, bool dup_later)
|
||||||
{
|
{
|
||||||
void *newcygheap;
|
void *newcygheap;
|
||||||
cygheap_protect->acquire ();
|
cygheap_protect.acquire ();
|
||||||
unsigned n = (char *) cygheap_max - (char *) cygheap;
|
unsigned n = (char *) cygheap_max - (char *) cygheap;
|
||||||
unsigned size = reserve_sz;
|
unsigned size = reserve_sz;
|
||||||
if (size < n)
|
if (size < n)
|
||||||
@ -115,7 +115,7 @@ cygheap_setup_for_child (child_info *ci, bool dup_later)
|
|||||||
ProtectHandle1INH (ci->cygheap_h, passed_cygheap_h);
|
ProtectHandle1INH (ci->cygheap_h, passed_cygheap_h);
|
||||||
if (!dup_later)
|
if (!dup_later)
|
||||||
dup_now (newcygheap, ci, n);
|
dup_now (newcygheap, ci, n);
|
||||||
cygheap_protect->release ();
|
cygheap_protect.release ();
|
||||||
ci->cygheap = cygheap;
|
ci->cygheap = cygheap;
|
||||||
ci->cygheap_max = cygheap_max;
|
ci->cygheap_max = cygheap_max;
|
||||||
ci->cygheap_reserve_sz = size;
|
ci->cygheap_reserve_sz = size;
|
||||||
@ -131,9 +131,9 @@ cygheap_setup_for_child_cleanup (void *newcygheap, child_info *ci,
|
|||||||
/* NOTE: There is an assumption here that cygheap_max has not changed
|
/* NOTE: There is an assumption here that cygheap_max has not changed
|
||||||
between the time that cygheap_setup_for_child was called and now.
|
between the time that cygheap_setup_for_child was called and now.
|
||||||
Make sure that this is a correct assumption. */
|
Make sure that this is a correct assumption. */
|
||||||
cygheap_protect->acquire ();
|
cygheap_protect.acquire ();
|
||||||
dup_now (newcygheap, ci, (char *) cygheap_max - (char *) cygheap);
|
dup_now (newcygheap, ci, (char *) cygheap_max - (char *) cygheap);
|
||||||
cygheap_protect->release ();
|
cygheap_protect.release ();
|
||||||
}
|
}
|
||||||
UnmapViewOfFile (newcygheap);
|
UnmapViewOfFile (newcygheap);
|
||||||
ForceCloseHandle1 (ci->cygheap_h, passed_cygheap_h);
|
ForceCloseHandle1 (ci->cygheap_h, passed_cygheap_h);
|
||||||
@ -254,7 +254,7 @@ _csbrk (int sbs)
|
|||||||
extern "C" void __stdcall
|
extern "C" void __stdcall
|
||||||
cygheap_init ()
|
cygheap_init ()
|
||||||
{
|
{
|
||||||
new_muto (cygheap_protect);
|
cygheap_protect.init ("cygheap_protect");
|
||||||
if (!cygheap)
|
if (!cygheap)
|
||||||
{
|
{
|
||||||
init_cheap ();
|
init_cheap ();
|
||||||
@ -288,7 +288,7 @@ _cmalloc (unsigned size)
|
|||||||
for (b = 3, sz = 8; sz && sz < size; b++, sz <<= 1)
|
for (b = 3, sz = 8; sz && sz < size; b++, sz <<= 1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
cygheap_protect->acquire ();
|
cygheap_protect.acquire ();
|
||||||
if (cygheap->buckets[b])
|
if (cygheap->buckets[b])
|
||||||
{
|
{
|
||||||
rvc = (_cmalloc_entry *) cygheap->buckets[b];
|
rvc = (_cmalloc_entry *) cygheap->buckets[b];
|
||||||
@ -300,7 +300,7 @@ _cmalloc (unsigned size)
|
|||||||
rvc = (_cmalloc_entry *) _csbrk (sz + sizeof (_cmalloc_entry));
|
rvc = (_cmalloc_entry *) _csbrk (sz + sizeof (_cmalloc_entry));
|
||||||
if (!rvc)
|
if (!rvc)
|
||||||
{
|
{
|
||||||
cygheap_protect->release ();
|
cygheap_protect.release ();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -308,19 +308,19 @@ _cmalloc (unsigned size)
|
|||||||
rvc->prev = cygheap->chain;
|
rvc->prev = cygheap->chain;
|
||||||
cygheap->chain = rvc;
|
cygheap->chain = rvc;
|
||||||
}
|
}
|
||||||
cygheap_protect->release ();
|
cygheap_protect.release ();
|
||||||
return rvc->data;
|
return rvc->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __stdcall
|
static void __stdcall
|
||||||
_cfree (void *ptr)
|
_cfree (void *ptr)
|
||||||
{
|
{
|
||||||
cygheap_protect->acquire ();
|
cygheap_protect.acquire ();
|
||||||
_cmalloc_entry *rvc = to_cmalloc (ptr);
|
_cmalloc_entry *rvc = to_cmalloc (ptr);
|
||||||
DWORD b = rvc->b;
|
DWORD b = rvc->b;
|
||||||
rvc->ptr = cygheap->buckets[b];
|
rvc->ptr = cygheap->buckets[b];
|
||||||
cygheap->buckets[b] = (char *) rvc;
|
cygheap->buckets[b] = (char *) rvc;
|
||||||
cygheap_protect->release ();
|
cygheap_protect.release ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *__stdcall
|
static void *__stdcall
|
||||||
|
@ -226,14 +226,14 @@ struct cwdstuff
|
|||||||
char *win32;
|
char *win32;
|
||||||
DWORD hash;
|
DWORD hash;
|
||||||
DWORD drive_length;
|
DWORD drive_length;
|
||||||
muto *cwd_lock;
|
static muto cwd_lock;
|
||||||
char *get (char *, int = 1, int = 0, unsigned = CYG_MAX_PATH);
|
char *get (char *, int = 1, int = 0, unsigned = CYG_MAX_PATH);
|
||||||
DWORD get_hash ();
|
DWORD get_hash ();
|
||||||
DWORD get_drive (char * dst)
|
DWORD get_drive (char * dst)
|
||||||
{
|
{
|
||||||
get_initial ();
|
get_initial ();
|
||||||
memcpy (dst, win32, drive_length);
|
memcpy (dst, win32, drive_length);
|
||||||
cwd_lock->release ();
|
cwd_lock.release ();
|
||||||
return drive_length;
|
return drive_length;
|
||||||
}
|
}
|
||||||
void init ();
|
void init ();
|
||||||
|
@ -25,9 +25,9 @@ void dlmalloc_stats ();
|
|||||||
#ifndef __INSIDE_CYGWIN__
|
#ifndef __INSIDE_CYGWIN__
|
||||||
# define USE_DL_PREFIX 1
|
# define USE_DL_PREFIX 1
|
||||||
#else
|
#else
|
||||||
# define __malloc_lock() mallock->acquire ()
|
# define __malloc_lock() mallock.acquire ()
|
||||||
# define __malloc_unlock() mallock->release ()
|
# define __malloc_unlock() mallock.release ()
|
||||||
extern muto *mallock;
|
extern muto mallock;
|
||||||
#endif
|
#endif
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -25,18 +25,18 @@ details. */
|
|||||||
|
|
||||||
class sentry
|
class sentry
|
||||||
{
|
{
|
||||||
static muto *lock;
|
static muto lock;
|
||||||
int destroy;
|
int destroy;
|
||||||
public:
|
public:
|
||||||
void init ();
|
void init ();
|
||||||
bool acquired () {return lock->acquired ();}
|
bool acquired () {return lock.acquired ();}
|
||||||
sentry () {destroy = 0;}
|
sentry () {destroy = 0;}
|
||||||
sentry (DWORD wait) {destroy = lock->acquire (wait);}
|
sentry (DWORD wait) {destroy = lock.acquire (wait);}
|
||||||
~sentry () {if (destroy) lock->release ();}
|
~sentry () {if (destroy) lock.release ();}
|
||||||
friend void _cygtls::init ();
|
friend void _cygtls::init ();
|
||||||
};
|
};
|
||||||
|
|
||||||
muto NO_COPY *sentry::lock;
|
muto NO_COPY sentry::lock;
|
||||||
|
|
||||||
static size_t NO_COPY nthreads;
|
static size_t NO_COPY nthreads;
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ _cygtls::init ()
|
|||||||
cygheap->threadlist = (_cygtls **) ccalloc (HEAP_TLS, cygheap->sthreads,
|
cygheap->threadlist = (_cygtls **) ccalloc (HEAP_TLS, cygheap->sthreads,
|
||||||
sizeof (cygheap->threadlist[0]));
|
sizeof (cygheap->threadlist[0]));
|
||||||
}
|
}
|
||||||
new_muto1 (sentry::lock, sentry_lock);
|
sentry::lock.init ("sentry_lock");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -47,6 +47,8 @@ HANDLE NO_COPY hMainProc = (HANDLE) -1;
|
|||||||
HANDLE NO_COPY hMainThread;
|
HANDLE NO_COPY hMainThread;
|
||||||
HANDLE NO_COPY hProcToken;
|
HANDLE NO_COPY hProcToken;
|
||||||
HANDLE NO_COPY hProcImpToken;
|
HANDLE NO_COPY hProcImpToken;
|
||||||
|
muto NO_COPY dtable::lock_cs; /* This should be in dtable.cc but it causes inexplicable
|
||||||
|
errors there. */
|
||||||
|
|
||||||
bool display_title;
|
bool display_title;
|
||||||
bool strip_title_path;
|
bool strip_title_path;
|
||||||
@ -1078,17 +1080,16 @@ do_exit (int status)
|
|||||||
myself.exit (n);
|
myself.exit (n);
|
||||||
}
|
}
|
||||||
|
|
||||||
static muto *atexit_lock;
|
static NO_COPY muto atexit_lock;
|
||||||
|
|
||||||
extern "C" int
|
extern "C" int
|
||||||
cygwin_atexit (void (*function)(void))
|
cygwin_atexit (void (*function)(void))
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
if (!atexit_lock)
|
atexit_lock.init ("atexit_lock");
|
||||||
new_muto (atexit_lock);
|
atexit_lock.acquire ();
|
||||||
atexit_lock->acquire ();
|
|
||||||
res = atexit (function);
|
res = atexit (function);
|
||||||
atexit_lock->release ();
|
atexit_lock.release ();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1096,7 +1097,7 @@ extern "C" void
|
|||||||
cygwin_exit (int n)
|
cygwin_exit (int n)
|
||||||
{
|
{
|
||||||
if (atexit_lock)
|
if (atexit_lock)
|
||||||
atexit_lock->acquire ();
|
atexit_lock.acquire ();
|
||||||
exit (n);
|
exit (n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,19 +31,19 @@ details. */
|
|||||||
|
|
||||||
class lock_debug
|
class lock_debug
|
||||||
{
|
{
|
||||||
static muto *locker;
|
static muto locker;
|
||||||
bool acquired;
|
bool acquired;
|
||||||
public:
|
public:
|
||||||
lock_debug () : acquired (0)
|
lock_debug () : acquired (0)
|
||||||
{
|
{
|
||||||
if (locker && !exit_state)
|
if (locker.name && !exit_state)
|
||||||
acquired = !!locker->acquire (INFINITE);
|
acquired = !!locker.acquire (INFINITE);
|
||||||
}
|
}
|
||||||
void unlock ()
|
void unlock ()
|
||||||
{
|
{
|
||||||
if (locker && acquired)
|
if (locker.name && acquired)
|
||||||
{
|
{
|
||||||
locker->release ();
|
locker.release ();
|
||||||
acquired = false;
|
acquired = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -51,15 +51,14 @@ class lock_debug
|
|||||||
friend void debug_init ();
|
friend void debug_init ();
|
||||||
};
|
};
|
||||||
|
|
||||||
muto NO_COPY *lock_debug::locker = NULL;
|
muto NO_COPY lock_debug::locker;
|
||||||
|
|
||||||
static bool __stdcall mark_closed (const char *, int, HANDLE, const char *, bool);
|
static bool __stdcall mark_closed (const char *, int, HANDLE, const char *, bool);
|
||||||
|
|
||||||
void
|
void
|
||||||
debug_init ()
|
debug_init ()
|
||||||
{
|
{
|
||||||
muto *debug_lock_muto;
|
lock_debug::locker.init ("debug_lock");
|
||||||
lock_debug::locker = new_muto (debug_lock_muto);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find a registered handle in the linked list of handles. */
|
/* Find a registered handle in the linked list of handles. */
|
||||||
|
@ -63,7 +63,7 @@ set_std_handle (int fd)
|
|||||||
void
|
void
|
||||||
dtable::init_lock ()
|
dtable::init_lock ()
|
||||||
{
|
{
|
||||||
new_muto (lock_cs);
|
lock_cs.init ("lock_cs");
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -20,7 +20,7 @@ class fhandler_fifo;
|
|||||||
#define BFH_OPTS (PC_NULLEMPTY | PC_FULL | PC_POSIX)
|
#define BFH_OPTS (PC_NULLEMPTY | PC_FULL | PC_POSIX)
|
||||||
class dtable
|
class dtable
|
||||||
{
|
{
|
||||||
muto *lock_cs;
|
static muto lock_cs;
|
||||||
fhandler_base **fds;
|
fhandler_base **fds;
|
||||||
#ifdef NEWVFORK
|
#ifdef NEWVFORK
|
||||||
fhandler_base **fds_on_hold;
|
fhandler_base **fds_on_hold;
|
||||||
@ -31,8 +31,8 @@ class dtable
|
|||||||
static const int initial_archetype_size = 8;
|
static const int initial_archetype_size = 8;
|
||||||
int first_fd_for_open;
|
int first_fd_for_open;
|
||||||
int cnt_need_fixup_before;
|
int cnt_need_fixup_before;
|
||||||
void lock () {lock_cs->acquire ();}
|
void lock () {lock_cs.acquire ();}
|
||||||
void unlock () {lock_cs->release ();}
|
void unlock () {lock_cs.release ();}
|
||||||
void init_lock ();
|
void init_lock ();
|
||||||
public:
|
public:
|
||||||
size_t size;
|
size_t size;
|
||||||
|
@ -49,7 +49,7 @@ static size_t windows_system_directory_length;
|
|||||||
/* This is set to indicate that we have already exited. */
|
/* This is set to indicate that we have already exited. */
|
||||||
|
|
||||||
static NO_COPY int exit_already = 0;
|
static NO_COPY int exit_already = 0;
|
||||||
static NO_COPY muto *mask_sync = NULL;
|
static NO_COPY muto mask_sync;
|
||||||
|
|
||||||
NO_COPY static struct
|
NO_COPY static struct
|
||||||
{
|
{
|
||||||
@ -901,11 +901,11 @@ sighold (int sig)
|
|||||||
syscall_printf ("signal %d out of range", sig);
|
syscall_printf ("signal %d out of range", sig);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
mask_sync->acquire (INFINITE);
|
mask_sync.acquire (INFINITE);
|
||||||
sigset_t mask = myself->getsigmask ();
|
sigset_t mask = myself->getsigmask ();
|
||||||
sigaddset (&mask, sig);
|
sigaddset (&mask, sig);
|
||||||
set_signal_mask (mask);
|
set_signal_mask (mask);
|
||||||
mask_sync->release ();
|
mask_sync.release ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -915,7 +915,7 @@ sighold (int sig)
|
|||||||
extern "C" sigset_t
|
extern "C" sigset_t
|
||||||
set_process_mask_delta ()
|
set_process_mask_delta ()
|
||||||
{
|
{
|
||||||
mask_sync->acquire (INFINITE);
|
mask_sync.acquire (INFINITE);
|
||||||
sigset_t newmask, oldmask;
|
sigset_t newmask, oldmask;
|
||||||
|
|
||||||
if (_my_tls.deltamask & SIG_NONMASKABLE)
|
if (_my_tls.deltamask & SIG_NONMASKABLE)
|
||||||
@ -926,7 +926,7 @@ set_process_mask_delta ()
|
|||||||
sigproc_printf ("oldmask %p, newmask %p, deltamask %p", oldmask, newmask,
|
sigproc_printf ("oldmask %p, newmask %p, deltamask %p", oldmask, newmask,
|
||||||
_my_tls.deltamask);
|
_my_tls.deltamask);
|
||||||
myself->setsigmask (newmask);
|
myself->setsigmask (newmask);
|
||||||
mask_sync->release ();
|
mask_sync.release ();
|
||||||
return oldmask;
|
return oldmask;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -935,7 +935,7 @@ set_process_mask_delta ()
|
|||||||
extern "C" void __stdcall
|
extern "C" void __stdcall
|
||||||
set_signal_mask (sigset_t newmask, sigset_t oldmask)
|
set_signal_mask (sigset_t newmask, sigset_t oldmask)
|
||||||
{
|
{
|
||||||
mask_sync->acquire (INFINITE);
|
mask_sync.acquire (INFINITE);
|
||||||
newmask &= ~SIG_NONMASKABLE;
|
newmask &= ~SIG_NONMASKABLE;
|
||||||
sigset_t mask_bits = oldmask & ~newmask;
|
sigset_t mask_bits = oldmask & ~newmask;
|
||||||
sigproc_printf ("oldmask %p, newmask %p, mask_bits %p", oldmask, newmask,
|
sigproc_printf ("oldmask %p, newmask %p, mask_bits %p", oldmask, newmask,
|
||||||
@ -945,7 +945,7 @@ set_signal_mask (sigset_t newmask, sigset_t oldmask)
|
|||||||
sig_dispatch_pending (true);
|
sig_dispatch_pending (true);
|
||||||
else
|
else
|
||||||
sigproc_printf ("not calling sig_dispatch_pending");
|
sigproc_printf ("not calling sig_dispatch_pending");
|
||||||
mask_sync->release ();
|
mask_sync.release ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1142,7 +1142,7 @@ events_init (void)
|
|||||||
api_fatal ("can't create title mutex '%s', %E", name);
|
api_fatal ("can't create title mutex '%s', %E", name);
|
||||||
|
|
||||||
ProtectHandle (tty_mutex);
|
ProtectHandle (tty_mutex);
|
||||||
new_muto (mask_sync);
|
mask_sync.init ("mask_sync");
|
||||||
windows_system_directory[0] = '\0';
|
windows_system_directory[0] = '\0';
|
||||||
(void) GetSystemDirectory (windows_system_directory, sizeof (windows_system_directory) - 2);
|
(void) GetSystemDirectory (windows_system_directory, sizeof (windows_system_directory) - 2);
|
||||||
char *end = strchr (windows_system_directory, '\0');
|
char *end = strchr (windows_system_directory, '\0');
|
||||||
|
@ -111,7 +111,7 @@ pwdgrp::pwdgrp (passwd *&pbuf) :
|
|||||||
{
|
{
|
||||||
read = &pwdgrp::read_passwd;
|
read = &pwdgrp::read_passwd;
|
||||||
parse = &pwdgrp::parse_passwd;
|
parse = &pwdgrp::parse_passwd;
|
||||||
new_muto (pglock);
|
pglock.init ("pwd_lock");
|
||||||
}
|
}
|
||||||
|
|
||||||
pwdgrp::pwdgrp (__group32 *&gbuf) :
|
pwdgrp::pwdgrp (__group32 *&gbuf) :
|
||||||
@ -119,7 +119,7 @@ pwdgrp::pwdgrp (__group32 *&gbuf) :
|
|||||||
{
|
{
|
||||||
read = &pwdgrp::read_group;
|
read = &pwdgrp::read_group;
|
||||||
parse = &pwdgrp::parse_group;
|
parse = &pwdgrp::parse_group;
|
||||||
new_muto (pglock);
|
pglock.init ("grp_lock");
|
||||||
}
|
}
|
||||||
|
|
||||||
struct __group32 *
|
struct __group32 *
|
||||||
|
@ -248,12 +248,12 @@ strdup (const char *s)
|
|||||||
newlib will call __malloc_lock and __malloc_unlock at appropriate
|
newlib will call __malloc_lock and __malloc_unlock at appropriate
|
||||||
times. */
|
times. */
|
||||||
|
|
||||||
NO_COPY muto *mallock = NULL;
|
muto NO_COPY mallock;
|
||||||
|
|
||||||
void
|
void
|
||||||
malloc_init ()
|
malloc_init ()
|
||||||
{
|
{
|
||||||
new_muto (mallock);
|
mallock.init ("mallock");
|
||||||
|
|
||||||
#ifndef MALLOC_DEBUG
|
#ifndef MALLOC_DEBUG
|
||||||
/* Check if malloc is provided by application. If so, redirect all
|
/* Check if malloc is provided by application. If so, redirect all
|
||||||
|
@ -104,6 +104,8 @@ struct symlink_info
|
|||||||
void set_error (int);
|
void set_error (int);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
muto NO_COPY cwdstuff::cwd_lock;
|
||||||
|
|
||||||
int pcheck_case = PCHECK_RELAXED; /* Determines the case check behaviour. */
|
int pcheck_case = PCHECK_RELAXED; /* Determines the case check behaviour. */
|
||||||
|
|
||||||
static const GUID GUID_shortcut
|
static const GUID GUID_shortcut
|
||||||
@ -3728,9 +3730,9 @@ DWORD
|
|||||||
cwdstuff::get_hash ()
|
cwdstuff::get_hash ()
|
||||||
{
|
{
|
||||||
DWORD hashnow;
|
DWORD hashnow;
|
||||||
cwd_lock->acquire ();
|
cwd_lock.acquire ();
|
||||||
hashnow = hash;
|
hashnow = hash;
|
||||||
cwd_lock->release ();
|
cwd_lock.release ();
|
||||||
return hashnow;
|
return hashnow;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3738,7 +3740,7 @@ cwdstuff::get_hash ()
|
|||||||
void
|
void
|
||||||
cwdstuff::init ()
|
cwdstuff::init ()
|
||||||
{
|
{
|
||||||
new_muto (cwd_lock);
|
cwd_lock.init ("cwd_lock");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get initial cwd. Should only be called once in a
|
/* Get initial cwd. Should only be called once in a
|
||||||
@ -3746,7 +3748,7 @@ cwdstuff::init ()
|
|||||||
bool
|
bool
|
||||||
cwdstuff::get_initial ()
|
cwdstuff::get_initial ()
|
||||||
{
|
{
|
||||||
cwd_lock->acquire ();
|
cwd_lock.acquire ();
|
||||||
|
|
||||||
if (win32)
|
if (win32)
|
||||||
return 1;
|
return 1;
|
||||||
@ -3766,7 +3768,7 @@ cwdstuff::set (const char *win32_cwd, const char *posix_cwd, bool doit)
|
|||||||
|
|
||||||
if (win32_cwd)
|
if (win32_cwd)
|
||||||
{
|
{
|
||||||
cwd_lock->acquire ();
|
cwd_lock.acquire ();
|
||||||
if (doit && !SetCurrentDirectory (win32_cwd))
|
if (doit && !SetCurrentDirectory (win32_cwd))
|
||||||
{
|
{
|
||||||
__seterrno ();
|
__seterrno ();
|
||||||
@ -3823,7 +3825,7 @@ cwdstuff::set (const char *win32_cwd, const char *posix_cwd, bool doit)
|
|||||||
res = 0;
|
res = 0;
|
||||||
out:
|
out:
|
||||||
if (win32_cwd)
|
if (win32_cwd)
|
||||||
cwd_lock->release ();
|
cwd_lock.release ();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3867,7 +3869,7 @@ cwdstuff::get (char *buf, int need_posix, int with_chroot, unsigned ulen)
|
|||||||
strcpy (buf, "/");
|
strcpy (buf, "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
cwd_lock->release ();
|
cwd_lock.release ();
|
||||||
|
|
||||||
out:
|
out:
|
||||||
syscall_printf ("(%s) = cwdstuff::get (%p, %d, %d, %d), errno %d",
|
syscall_printf ("(%s) = cwdstuff::get (%p, %d, %d, %d), errno %d",
|
||||||
|
@ -39,7 +39,7 @@ class pwdgrp
|
|||||||
char *buf, *lptr;
|
char *buf, *lptr;
|
||||||
int max_lines;
|
int max_lines;
|
||||||
bool initialized;
|
bool initialized;
|
||||||
muto *pglock;
|
muto pglock;
|
||||||
|
|
||||||
bool parse_passwd ();
|
bool parse_passwd ();
|
||||||
bool parse_group ();
|
bool parse_group ();
|
||||||
@ -72,10 +72,10 @@ public:
|
|||||||
{
|
{
|
||||||
if (!check && initialized)
|
if (!check && initialized)
|
||||||
return;
|
return;
|
||||||
if (pglock->acquire () == 1 &&
|
if (pglock.acquire () == 1 &&
|
||||||
(!initialized || (check && etc::file_changed (etc_ix))))
|
(!initialized || (check && etc::file_changed (etc_ix))))
|
||||||
(this->*read) ();
|
(this->*read) ();
|
||||||
pglock->release ();
|
pglock.release ();
|
||||||
}
|
}
|
||||||
|
|
||||||
pwdgrp (passwd *&pbuf);
|
pwdgrp (passwd *&pbuf);
|
||||||
|
@ -70,7 +70,7 @@ Static char cprocs[(NPROCS + 1) * sizeof (pinfo)];// All my children info
|
|||||||
// constructor operation at DLL startup
|
// constructor operation at DLL startup
|
||||||
Static waitq waitq_head = {0, 0, 0, 0, 0, 0, 0};// Start of queue for wait'ing threads
|
Static waitq waitq_head = {0, 0, 0, 0, 0, 0, 0};// Start of queue for wait'ing threads
|
||||||
|
|
||||||
muto NO_COPY *sync_proc_subproc = NULL; // Control access to subproc stuff
|
muto NO_COPY sync_proc_subproc; // Control access to subproc stuff
|
||||||
|
|
||||||
DWORD NO_COPY sigtid = 0; // ID of the signal thread
|
DWORD NO_COPY sigtid = 0; // ID of the signal thread
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ get_proc_lock (DWORD what, DWORD val)
|
|||||||
sigproc_printf ("sync_proc_subproc is NULL (1)");
|
sigproc_printf ("sync_proc_subproc is NULL (1)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (sync_proc_subproc->acquire (WPSP))
|
if (sync_proc_subproc.acquire (WPSP))
|
||||||
{
|
{
|
||||||
lastwhat = what;
|
lastwhat = what;
|
||||||
return true;
|
return true;
|
||||||
@ -351,7 +351,7 @@ proc_subproc (DWORD what, DWORD val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
sync_proc_subproc->release (); // Release the lock
|
sync_proc_subproc.release (); // Release the lock
|
||||||
out1:
|
out1:
|
||||||
sigproc_printf ("returning %d", rc);
|
sigproc_printf ("returning %d", rc);
|
||||||
return rc;
|
return rc;
|
||||||
@ -363,7 +363,7 @@ out1:
|
|||||||
void
|
void
|
||||||
_cygtls::remove_wq (DWORD wait)
|
_cygtls::remove_wq (DWORD wait)
|
||||||
{
|
{
|
||||||
if (sync_proc_subproc && sync_proc_subproc->acquire (wait))
|
if (sync_proc_subproc && sync_proc_subproc.acquire (wait))
|
||||||
{
|
{
|
||||||
for (waitq *w = &waitq_head; w->next != NULL; w = w->next)
|
for (waitq *w = &waitq_head; w->next != NULL; w = w->next)
|
||||||
if (w->next == &wq)
|
if (w->next == &wq)
|
||||||
@ -372,7 +372,7 @@ _cygtls::remove_wq (DWORD wait)
|
|||||||
w->next = wq.next;
|
w->next = wq.next;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sync_proc_subproc->release ();
|
sync_proc_subproc.release ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,7 +389,7 @@ proc_terminate (void)
|
|||||||
/* Signal processing is assumed to be blocked in this routine. */
|
/* Signal processing is assumed to be blocked in this routine. */
|
||||||
if (nprocs)
|
if (nprocs)
|
||||||
{
|
{
|
||||||
sync_proc_subproc->acquire (WPSP);
|
sync_proc_subproc.acquire (WPSP);
|
||||||
|
|
||||||
(void) proc_subproc (PROC_CLEARWAIT, 1);
|
(void) proc_subproc (PROC_CLEARWAIT, 1);
|
||||||
|
|
||||||
@ -406,7 +406,7 @@ proc_terminate (void)
|
|||||||
procs[i].release ();
|
procs[i].release ();
|
||||||
}
|
}
|
||||||
nprocs = 0;
|
nprocs = 0;
|
||||||
sync_proc_subproc->release ();
|
sync_proc_subproc.release ();
|
||||||
}
|
}
|
||||||
sigproc_printf ("leaving");
|
sigproc_printf ("leaving");
|
||||||
}
|
}
|
||||||
@ -488,7 +488,7 @@ sigproc_init ()
|
|||||||
/* sync_proc_subproc is used by proc_subproc. It serialises
|
/* sync_proc_subproc is used by proc_subproc. It serialises
|
||||||
* access to the children and proc arrays.
|
* access to the children and proc arrays.
|
||||||
*/
|
*/
|
||||||
new_muto (sync_proc_subproc);
|
sync_proc_subproc.init ("sync_proc_subproc");
|
||||||
|
|
||||||
create_signal_arrived ();
|
create_signal_arrived ();
|
||||||
|
|
||||||
|
@ -16,6 +16,9 @@ details. */
|
|||||||
there are issues with malloc and fork. */
|
there are issues with malloc and fork. */
|
||||||
class muto
|
class muto
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
const char *name;
|
||||||
|
private:
|
||||||
static DWORD exiting_thread;
|
static DWORD exiting_thread;
|
||||||
LONG sync; /* Used to serialize access to this class. */
|
LONG sync; /* Used to serialize access to this class. */
|
||||||
LONG waiters; /* Number of threads waiting for lock. */
|
LONG waiters; /* Number of threads waiting for lock. */
|
||||||
@ -24,10 +27,9 @@ public:
|
|||||||
LONG visits; /* Count of number of times a thread has called acquire. */
|
LONG visits; /* Count of number of times a thread has called acquire. */
|
||||||
void *tls; /* Tls of lock owner. */
|
void *tls; /* Tls of lock owner. */
|
||||||
// class muto *next;
|
// class muto *next;
|
||||||
const char *name;
|
|
||||||
|
|
||||||
/* The real constructor. */
|
/* The real constructor. */
|
||||||
muto *init(const char *name) __attribute__ ((regparm (3)));
|
muto *init (const char *) __attribute__ ((regparm (2)));
|
||||||
|
|
||||||
#if 0 /* FIXME: See comment in sync.cc */
|
#if 0 /* FIXME: See comment in sync.cc */
|
||||||
~muto ()
|
~muto ()
|
||||||
@ -38,35 +40,8 @@ public:
|
|||||||
bool acquired () __attribute__ ((regparm (1)));
|
bool acquired () __attribute__ ((regparm (1)));
|
||||||
void upforgrabs () {tls = this;} // just set to an invalid address
|
void upforgrabs () {tls = this;} // just set to an invalid address
|
||||||
void grab () __attribute__ ((regparm (1)));
|
void grab () __attribute__ ((regparm (1)));
|
||||||
|
operator int () const {return !!name;}
|
||||||
static void set_exiting_thread () {exiting_thread = GetCurrentThreadId ();}
|
static void set_exiting_thread () {exiting_thread = GetCurrentThreadId ();}
|
||||||
};
|
};
|
||||||
|
|
||||||
class locker
|
|
||||||
{
|
|
||||||
muto *room;
|
|
||||||
public:
|
|
||||||
locker (muto *m) {room = m; room->acquire ();}
|
|
||||||
~locker () {room->release ();}
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Use a statically allocated buffer as the storage for a muto */
|
|
||||||
#define new_muto(__name) \
|
|
||||||
({ \
|
|
||||||
static muto __name##_storage __attribute__((nocommon)) __attribute__((section(".data_cygwin_nocopy1"))); \
|
|
||||||
__name = __name##_storage.init (#__name); \
|
|
||||||
})
|
|
||||||
|
|
||||||
/* Use a statically allocated buffer as the storage for a muto */
|
|
||||||
#define new_muto1(__name, __storage) \
|
|
||||||
({ \
|
|
||||||
static muto __storage __attribute__((nocommon)) __attribute__((section(".data_cygwin_nocopy1"))); \
|
|
||||||
__name = __storage.init (#__name); \
|
|
||||||
})
|
|
||||||
|
|
||||||
/* Use a statically allocated buffer as the storage for a muto */
|
|
||||||
#define new_muto_name(__var, __name) \
|
|
||||||
({ \
|
|
||||||
static muto __var##_storage __attribute__((nocommon)) __attribute__((section(".data_cygwin_nocopy1"))); \
|
|
||||||
__var = __var##_storage.init (__name); \
|
|
||||||
})
|
|
||||||
#endif /*_SYNC_H*/
|
#endif /*_SYNC_H*/
|
||||||
|
@ -43,22 +43,22 @@ timer_tracker NO_COPY ttstart (CLOCK_REALTIME, NULL);
|
|||||||
|
|
||||||
class lock_timer_tracker
|
class lock_timer_tracker
|
||||||
{
|
{
|
||||||
static muto *protect;
|
static muto protect;
|
||||||
public:
|
public:
|
||||||
lock_timer_tracker ();
|
lock_timer_tracker ();
|
||||||
~lock_timer_tracker ();
|
~lock_timer_tracker ();
|
||||||
};
|
};
|
||||||
|
|
||||||
muto NO_COPY *lock_timer_tracker::protect;
|
muto NO_COPY lock_timer_tracker::protect;
|
||||||
|
|
||||||
lock_timer_tracker::lock_timer_tracker ()
|
lock_timer_tracker::lock_timer_tracker ()
|
||||||
{
|
{
|
||||||
new_muto (protect)->acquire ();
|
protect.init ("timer_protect")->acquire ();
|
||||||
}
|
}
|
||||||
|
|
||||||
lock_timer_tracker::~lock_timer_tracker ()
|
lock_timer_tracker::~lock_timer_tracker ()
|
||||||
{
|
{
|
||||||
protect->release ();
|
protect.release ();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -30,7 +30,7 @@ details. */
|
|||||||
|
|
||||||
wininfo NO_COPY winmsg;
|
wininfo NO_COPY winmsg;
|
||||||
|
|
||||||
muto NO_COPY *wininfo::_lock;
|
muto NO_COPY wininfo::_lock;
|
||||||
|
|
||||||
int __stdcall
|
int __stdcall
|
||||||
wininfo::process (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
wininfo::process (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
@ -70,7 +70,7 @@ wininfo::winthread ()
|
|||||||
WNDCLASS wc;
|
WNDCLASS wc;
|
||||||
static NO_COPY char classname[] = "CygwinWndClass";
|
static NO_COPY char classname[] = "CygwinWndClass";
|
||||||
|
|
||||||
_lock->grab ();
|
_lock.grab ();
|
||||||
/* Register the window class for the main window. */
|
/* Register the window class for the main window. */
|
||||||
|
|
||||||
wc.style = 0;
|
wc.style = 0;
|
||||||
@ -117,7 +117,7 @@ HWND ()
|
|||||||
lock ();
|
lock ();
|
||||||
if (!hwnd)
|
if (!hwnd)
|
||||||
{
|
{
|
||||||
_lock->upforgrabs ();
|
_lock.upforgrabs ();
|
||||||
cygthread *h = new cygthread (::winthread, this, "win");
|
cygthread *h = new cygthread (::winthread, this, "win");
|
||||||
h->SetThreadPriority (THREAD_PRIORITY_HIGHEST);
|
h->SetThreadPriority (THREAD_PRIORITY_HIGHEST);
|
||||||
h->zap_h ();
|
h->zap_h ();
|
||||||
@ -130,11 +130,11 @@ HWND ()
|
|||||||
void
|
void
|
||||||
wininfo::lock ()
|
wininfo::lock ()
|
||||||
{
|
{
|
||||||
new_muto (_lock)->acquire ();
|
_lock.init ("wininfo_lock")->acquire ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wininfo::release ()
|
wininfo::release ()
|
||||||
{
|
{
|
||||||
_lock->release ();
|
_lock.release ();
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ class muto;
|
|||||||
class wininfo
|
class wininfo
|
||||||
{
|
{
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
static muto *_lock;
|
static muto _lock;
|
||||||
public:
|
public:
|
||||||
operator HWND ();
|
operator HWND ();
|
||||||
int __stdcall wininfo::process (HWND, UINT, WPARAM, LPARAM)
|
int __stdcall wininfo::process (HWND, UINT, WPARAM, LPARAM)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user