~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/thr_mutex.c

  • Committer: Monty Taylor
  • Date: 2008-09-15 17:24:04 UTC
  • Revision ID: monty@inaugust.com-20080915172404-ygh6hiyu0q7qpa9x
Removed strndup calls.

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
int safe_mutex_init(safe_mutex_t *mp,
56
56
                    const pthread_mutexattr_t *attr __attribute__((unused)),
57
57
                    const char *file,
58
 
                    uint32_t line)
 
58
                    uint line)
59
59
{
60
60
  memset(mp, 0, sizeof(*mp));
61
61
  pthread_mutex_init(&mp->global,MY_MUTEX_INIT_ERRCHK);
92
92
}
93
93
 
94
94
 
95
 
int safe_mutex_lock(safe_mutex_t *mp, bool try_lock, const char *file, uint32_t line)
 
95
int safe_mutex_lock(safe_mutex_t *mp, bool try_lock, const char *file, uint line)
96
96
{
97
97
  int error;
98
98
  if (!mp->file)
171
171
}
172
172
 
173
173
 
174
 
int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint32_t line)
 
174
int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line)
175
175
{
176
176
  int error;
177
177
  pthread_mutex_lock(&mp->global);
204
204
 
205
205
 
206
206
int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp, const char *file,
207
 
                   uint32_t line)
 
207
                   uint line)
208
208
{
209
209
  int error;
210
210
  pthread_mutex_lock(&mp->global);
256
256
 
257
257
int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
258
258
                        struct timespec *abstime,
259
 
                        const char *file, uint32_t line)
 
259
                        const char *file, uint line)
260
260
{
261
261
  int error;
262
262
  pthread_mutex_lock(&mp->global);
292
292
}
293
293
 
294
294
 
295
 
int safe_mutex_destroy(safe_mutex_t *mp, const char *file, uint32_t line)
 
295
int safe_mutex_destroy(safe_mutex_t *mp, const char *file, uint line)
296
296
{
297
297
  int error=0;
298
298
  if (!mp->file)
354
354
   This is ok, as this thread may not yet have been exited.
355
355
*/
356
356
 
357
 
void safe_mutex_end(int *file __attribute__((unused)))
 
357
void safe_mutex_end(FILE *file __attribute__((unused)))
358
358
{
359
359
  if (!safe_mutex_count)                        /* safetly */
360
360
    pthread_mutex_destroy(&THR_LOCK_mutex);
388
388
#include <m_string.h>
389
389
 
390
390
#include <m_ctype.h>
 
391
#include <hash.h>
391
392
#include <myisampack.h>
392
393
#include <mysys_err.h>
393
394
#include <my_sys.h>
432
433
int my_pthread_fastmutex_lock(my_pthread_fastmutex_t *mp)
433
434
{
434
435
  int   res;
435
 
  uint32_t  i;
436
 
  uint32_t  maxdelay= MY_PTHREAD_FASTMUTEX_DELAY;
 
436
  uint  i;
 
437
  uint  maxdelay= MY_PTHREAD_FASTMUTEX_DELAY;
437
438
 
438
439
  for (i= 0; i < mp->spins; i++)
439
440
  {