mirror of https://github.com/deavmi/tasky.git
Fixed page fault as Mutex address falled into null page (null, or any unmapped)
This commit is contained in:
parent
f9b2d24e8c
commit
f19b6595f1
|
@ -3,7 +3,7 @@ module tasky.engine;
|
|||
import std.container.dlist : DList;
|
||||
import core.sync.mutex : Mutex;
|
||||
import tristanable.manager;
|
||||
import std.socket : Socket;
|
||||
import std.socket;
|
||||
import tristanable.queue : Queue;
|
||||
import tristanable.queueitem;
|
||||
import tristanable.encoding : DataMessage, encodeForSend;
|
||||
|
@ -11,6 +11,44 @@ import eventy;
|
|||
|
||||
import core.thread : Thread;
|
||||
|
||||
unittest
|
||||
{
|
||||
|
||||
/**
|
||||
* Server process
|
||||
*/
|
||||
Socket servSocket = new Socket(AddressFamily.INET6, SocketType.STREAM, ProtocolType.TCP);
|
||||
servSocket.bind(parseAddress("::1", 0));
|
||||
servSocket.listen(0);
|
||||
|
||||
auto serverThread = new class Thread
|
||||
{
|
||||
this()
|
||||
{
|
||||
super(&worker);
|
||||
}
|
||||
|
||||
private void worker()
|
||||
{
|
||||
|
||||
while(true)
|
||||
{
|
||||
Socket client = servSocket.accept();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* Start the server thread */
|
||||
serverThread.start();
|
||||
|
||||
/* Open a socket to the server */
|
||||
Socket conn = new Socket(AddressFamily.INET6, SocketType.STREAM, ProtocolType.TCP);
|
||||
conn.connect(servSocket.localAddress);
|
||||
|
||||
/* Start the task manager */
|
||||
TaskManager taskManager = new TaskManager(conn);
|
||||
}
|
||||
|
||||
public final class TaskManager : Thread
|
||||
{
|
||||
/**
|
||||
|
@ -39,6 +77,9 @@ public final class TaskManager : Thread
|
|||
/* Initialize the event-loop */
|
||||
eventEngine = new Engine();
|
||||
|
||||
/* Initialize job queue lock */
|
||||
jobsLock = new Mutex();
|
||||
|
||||
/* Start the thread */
|
||||
start();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue