version 1.131, 2008/02/29 18:12:38
|
version 1.132, 2008/03/19 19:21:34
|
|
|
_uninitialize(); | _uninitialize(); |
} | } |
| |
|
void Tickler::notify() |
|
{ |
|
Socket::write(_clientSocket, "\0", 1); |
|
} |
|
|
|
void Tickler::reset() |
|
{ |
|
// Clear all bytes from the tickle socket |
|
char buffer[32]; |
|
while (Socket::read(_serverSocket, buffer, 32) > 0) |
|
{ |
|
} |
|
} |
|
|
#if defined(PEGASUS_OS_TYPE_UNIX) | #if defined(PEGASUS_OS_TYPE_UNIX) |
| |
// Use an anonymous pipe for the tickle connection. | // Use an anonymous pipe for the tickle connection. |
|
|
| |
_serverSocket = fds[0]; | _serverSocket = fds[0]; |
_clientSocket = fds[1]; | _clientSocket = fds[1]; |
|
|
|
Socket::disableBlocking(_serverSocket); |
} | } |
| |
#else | #else |
|
|
// Create a MonitorEntry for the Tickler and set its state to IDLE so the | // Create a MonitorEntry for the Tickler and set its state to IDLE so the |
// Monitor will watch for its events. | // Monitor will watch for its events. |
_entries.append(MonitorEntry( | _entries.append(MonitorEntry( |
_tickler.getServerSocket(), |
_tickler.getReadHandle(), |
1, | 1, |
MonitorEntry::STATUS_IDLE, | MonitorEntry::STATUS_IDLE, |
MonitorEntry::TYPE_INTERNAL)); |
MonitorEntry::TYPE_TICKLER)); |
| |
// Start the count at 1 because _entries[0] is the Tickler | // Start the count at 1 because _entries[0] is the Tickler |
for (int i = 1; i < numberOfMonitorEntriesToAllocate; i++) | for (int i = 1; i < numberOfMonitorEntriesToAllocate; i++) |
|
|
| |
void Monitor::tickle() | void Monitor::tickle() |
{ | { |
Socket::write(_tickler.getClientSocket(), "\0", 1); |
_tickler.notify(); |
} | } |
| |
void Monitor::setState( | void Monitor::setState( |
|
|
| |
| |
} | } |
else if (entries[indx].type == MonitorEntry::TYPE_INTERNAL) |
else if (entries[indx].type == MonitorEntry::TYPE_TICKLER) |
{ | { |
char buffer; |
_tickler.reset(); |
Sint32 ignored = |
|
Socket::read(entries[indx].socket, &buffer, 1); |
|
} | } |
else | else |
{ | { |