Skip to content

Commit

Permalink
switch to C allocation for other threads
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Sep 22, 2011
1 parent 0cd550b commit bcc14a3
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/root/async.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <process.h>

#include "root.h"
#include "rmem.h"

static unsigned __stdcall startthread(void *p);

Expand Down Expand Up @@ -41,7 +40,7 @@ struct AsyncRead

AsyncRead *AsyncRead::create(size_t nfiles)
{
AsyncRead *aw = (AsyncRead *)mem.calloc(1, sizeof(AsyncRead) +
AsyncRead *aw = (AsyncRead *)calloc(1, sizeof(AsyncRead) +
(nfiles - 1) * sizeof(FileData));
aw->filesmax = nfiles;
return aw;
Expand Down Expand Up @@ -92,7 +91,7 @@ int AsyncRead::read(size_t i)

void AsyncRead::dispose(AsyncRead *aw)
{
delete aw;
free(aw);
}


Expand All @@ -119,7 +118,6 @@ unsigned __stdcall startthread(void *p)
#include <time.h>

#include "root.h"
#include "rmem.h"

void *startthread(void *arg);

Expand Down Expand Up @@ -155,7 +153,7 @@ struct AsyncRead

AsyncRead *AsyncRead::create(size_t nfiles)
{
AsyncRead *aw = (AsyncRead *)mem.calloc(1, sizeof(AsyncRead) +
AsyncRead *aw = (AsyncRead *)calloc(1, sizeof(AsyncRead) +
(nfiles - 1) * sizeof(FileData));
aw->filesmax = nfiles;
return aw;
Expand Down Expand Up @@ -228,7 +226,7 @@ void AsyncRead::dispose(AsyncRead *aw)
if (status != 0)
err_abort(status, "mutex destroy");
}
delete aw;
free(aw);
}


Expand Down Expand Up @@ -265,7 +263,6 @@ void *startthread(void *p)
#include <errno.h>

#include "root.h"
#include "rmem.h"

struct FileData
{
Expand All @@ -292,7 +289,7 @@ struct AsyncRead

AsyncRead *AsyncRead::create(size_t nfiles)
{
AsyncRead *aw = (AsyncRead *)mem.calloc(1, sizeof(AsyncRead) +
AsyncRead *aw = (AsyncRead *)calloc(1, sizeof(AsyncRead) +
(nfiles - 1) * sizeof(FileData));
aw->filesmax = nfiles;
return aw;
Expand Down Expand Up @@ -322,7 +319,7 @@ int AsyncRead::read(size_t i)

void AsyncRead::dispose(AsyncRead *aw)
{
delete aw;
free(aw);
}

#endif

0 comments on commit bcc14a3

Please sign in to comment.