/** * Implementation of support routines for synchronized blocks. * * Copyright: Copyright Digital Mars 2000 - 2011. * License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0). * Authors: Walter Bright, Sean Kelly */ /* Copyright Digital Mars 2000 - 2011. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE or copy at * http://www.boost.org/LICENSE_1_0.txt) */ module rt.critical_; nothrow: import rt.monitor_, core.atomic; extern (C) void _d_critical_init() { initMutex(cast(Mutex*)&gcs.mtx); head = &gcs; } extern (C) void _d_critical_term() { for (auto p = head; p; p = p.next) destroyMutex(cast(Mutex*)&p.mtx); } extern (C) void _d_criticalenter(D_CRITICAL_SECTION* cs) { ensureMutex(cast(shared(D_CRITICAL_SECTION*)) cs); lockMutex(&cs.mtx); } extern (C) void _d_criticalexit(D_CRITICAL_SECTION* cs) { unlockMutex(&cs.mtx); } private: shared D_CRITICAL_SECTION* head; shared D_CRITICAL_SECTION gcs; struct D_CRITICAL_SECTION { D_CRITICAL_SECTION* next; Mutex mtx; } void ensureMutex(shared(D_CRITICAL_SECTION)* cs) { if (atomicLoad!(MemoryOrder.acq)(cs.next) is null) { lockMutex(cast(Mutex*)&gcs.mtx); if (atomicLoad!(MemoryOrder.raw)(cs.next) is null) { initMutex(cast(Mutex*)&cs.mtx); auto ohead = head; head = cs; atomicStore!(MemoryOrder.rel)(cs.next, ohead); } unlockMutex(cast(Mutex*)&gcs.mtx); } } t/sys/dev/raidframe/rf_diskqueue.c?id=9d12f258cda5ec0049da01acd431bab446e6f537'>commitdiff
path: root/sys/dev/raidframe/rf_diskqueue.c
AgeCommit message (Expand)Author
2011-05-05convert the diskqueue mutex into a kmutexmrg
2009-03-23Rework/simplify the disk queuing code. A bunch of this was stilloster
2008-06-17Mark a buffer `busy` in getnewbuf() when it came from the pool_cache sincereinoud
2008-01-02Merge vmlocking2 to head.ad
2007-03-04Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.christos
2006-11-16__unused removal on arguments; approved by core.christos
2006-10-12- sprinkle __unused on function decls.christos
2006-10-05Protect calls to pool_put/pool_get that may occur in interrupt contexttls
2006-01-08Cleanup the initialization of buffers a bit, and remove some old codeoster
2006-01-06initialize necessary members of struct buf. PR/32462 from Reinoud Zandijk.yamt
2006-01-04- add simple functions to allocate/free a buffer for i/o.yamt
2005-12-11merge ktrace-lwp.christos
2005-05-29- avoid variable shadowingchristos
2005-02-27nuke trailing whitespaceperry
2005-02-12The 'next' argument to rf_CreateDiskQueueData is always NULL. Sinceoster
2005-02-12Add a 'waitflag' argument to rf_CreateDiskQueueData() and use it tooster
2005-02-05CreateDiskQueueData() doesn't need to use void * for raidPtr.oster
2004-11-24Only touch bufpool whilst in splbio(). (That should be the caseoster
2004-03-23bufpool must be accessed at splbio().oster
2004-03-21Doesn't hurt much to zero this before we start mucking with it.oster
2004-03-07- Introduce rf_pools which contains all of the various global pools usedoster
2004-03-07- Introduce rf_pools which contains all of the various global pools usedoster
2004-03-05- remove the RF_*_INC's, as necessary. They are not needed any more.oster
2004-02-29Adjust _rf_ShutdownCreate() so that it is willing to wait for moreoster
2004-01-01Nuke a bunch of unused variables:oster
2003-12-31init_dqd and clean_dqd don't do enough to be their own functions,oster
2003-12-30Some days you wonder if some of the function declaration consistencyoster
2003-12-29_rf_create_managed_cond() is now left doing nothing. Convert callers.oster
2003-12-29_rf_create_managed_mutex() is doing just a simple:oster
2003-12-29- first kick at a major reworking of RAIDframe's memory allocation code:oster
2003-12-29[Having received a definite lack of strenuous objection, a small amountoster
2003-02-09constify somejdolecek
2002-09-17Use RF_DEBUG_DISKQUEUE to eliminate more debuggin printfs that theoster
2002-09-15Nuke unlockingOp -- it was only used for the userland version of theoster
2002-09-15'buf2' is unused. Nuke it.oster
2002-09-14Everyone and their dog was using RF_ERRORMSG3 to print out the sameoster
2002-08-02- AuxFunc is no longer used.oster
2002-08-02It appears that nothing is using rf_CreateDiskQueueDataFull. Make it evenoster
2001-11-13add RCSIDslukem
2001-10-04Step 2 of the disentanglement. We now look to <dev/raidframe/*> foroster
2000-03-04Reorganize some comments.oster
2000-03-04Garbage collect the (already disabled) "random" queue type.oster
2000-02-24Garbage collect some unused stuff. Include rf_kintf.h for aoster
2000-02-24- record the pointer to the DiskQueueSW so we can use that whenoster
2000-02-13Get recent changes into the tree:oster