Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Signal.cpp
00001 /* 00002 * Signal.cpp 00003 * Copyright (c) 2017, ZHAW 00004 * All rights reserved. 00005 */ 00006 00007 #include "Signal.h" 00008 00009 using namespace std; 00010 00011 int32_t Signal::signals = 0; 00012 00013 /** 00014 * Creates a signal object and assignes a unique flag. 00015 */ 00016 Signal::Signal() { 00017 00018 mutex.lock(); 00019 00020 int32_t n = 0; 00021 while ((((1 << n) & signals) > 0) && (n < 30)) n++; 00022 signal = (1 << n); 00023 00024 mutex.unlock(); 00025 } 00026 00027 /** 00028 * Deletes the signal object and releases the assigned flag. 00029 */ 00030 Signal::~Signal() { 00031 00032 mutex.lock(); 00033 00034 signals &= ~signal; 00035 00036 mutex.unlock(); 00037 } 00038 00039 /** 00040 * Gets the assigned signal flag. 00041 */ 00042 int32_t Signal::read() { 00043 00044 return signal; 00045 } 00046 00047 /** 00048 * The empty operator is a shorthand notation of the <code>read()</code> method. 00049 */ 00050 Signal::operator int32_t() { 00051 00052 return read(); 00053 } 00054
Generated on Wed Jul 13 2022 23:05:32 by
1.7.2