Toggle navigation
Beam GIT List
GitHub
Repo
Changelog
To do
Releases
Themes
Change log
Loading change log ...
To do ...
Loading todo ...
browsing:
bdbf10d4dfd924f118dc29da98a22199724c7962
Branches
master
Tags
tms/release-pre-2.1.0
tms/release-2.2.1
tms/release-2.2.0
tms/release-2.1.0
tms/release-2.0.6
tms/release-2.0.5
tms/release-2.0.4
tms/release-2.0.3first
tms/release-2.0.3
tms/release-1.2.12
tms/release-1.2.11
tms/release-1.2.10
tms/release-1.2.9
tms/release-1.2.8
tms/release-1.2.6a
tms/release-1.2.6
tms/release-1.2.4
tms/release-1.2.3
tms/release-1.2.2
tms/release-1.2.0
tms/release-1.1.2
tms/release-1.1.1
tms/release-1.0.2
tms/release-1.0.1
tms/release-1.0.0
tms/release-0.4.3
tms/release-0.4.2
tms/release-0.4.1
tms/release-0.3.14
tms/release-0.3.13
tms/release-0.3.12
tms/release-0.3.10
tms/release-0.3.9
tms/release-0.3.8
tms/release-0.3.5
tms/release-0.3.4
tms/release-0.3.3
tms/release-0.2.7
tms/release-0.2.5
tms/release-0.2.3
tms-mcsys/release-2.1.0-1.beam
tms-mcsys/release-2.0.6-1.beam
tms-mcsys/release-1.2.9-1.beam
tms-fpga/release-1.2.5
tms-fpga/release-1.2.4
Files
Commits
Log
Graph
Stats
tms-old
beam
libBeam
BEvent.cpp
RSS
Git
Fetch origin
Download
ZIP
TAR
Clone
Raw
View
History
Clone
HTTPS
Blames found: 29
Mode: text/x-c++src
Binary: false
Hang on, we reloading big blames...
6ae0d525
/*******************************************************************************
57456599
* BEvent.cpp Event class * T.Barnaby, BEAM Ltd, 2005-07-08 * Copyright (c) 2005 All Right Reserved, Beam Ltd, http://www.beam.ltd.uk
6ae0d525
******************************************************************************* */ #include <BEvent.h> #include <BPoll.h>
57456599
#include <stdlib.h> #include <unistd.h> #include <sys/ioctl.h> BEvent::BEvent(BUInt32 type, BUInt32 arg) : otype(type), oarg(arg){
6ae0d525
}
57456599
BUInt32 BEvent::type(){
6ae0d525
return otype; }
57456599
BUInt32 BEvent::arg(){ return oarg;
6ae0d525
} BEventPipe::BEventPipe(){ pipe(ofds); } BEventPipe::~BEventPipe(){ close(ofds[0]); close(ofds[1]); }
57456599
void BEventPipe::clear(){ BEvent e;
6ae0d525
57456599
while(!read(e, 0));
6ae0d525
}
57456599
int BEventPipe::getFd(){
6ae0d525
return ofds[0]; }
57456599
BUInt BEventPipe::writeAvailable() const { return 1;
6ae0d525
}
57456599
BError BEventPipe::write(const BEvent& event, BTimeout timeout){
6ae0d525
BError err;
57456599
::write(ofds[1], &event, sizeof(event));
6ae0d525
return err; }
57456599
BUInt BEventPipe::readAvailable() const{ int nBytes = 0; ioctl(ofds[0], FIONREAD, &nBytes); return nBytes / sizeof(BEvent); } BError BEventPipe::read(BEvent& event, BTimeout timeout){
6ae0d525
BError err; BPoll poll; int fd;
57456599
if(timeout != BTimeoutForever){
6ae0d525
poll.append(ofds[0]);
57456599
if(err = poll.doPoll(fd, timeout))
6ae0d525
return err; }
57456599
::read(ofds[0], &event, sizeof(event));
6ae0d525
return err; }